Re: Something interesting please post here (Metatrader)

4316
Intrest 1 wrote: Sun Mar 15, 2026 6:31 pm.
"Does the indicator repaint?"

Yes, this indicator does repaint. Let me explain exactly why, because the repainting is subtle and comes from the logic rather than typical future-bar indexing.

1️⃣ The arrow is drawn on a past bar after future confirmation

The key repainting line is here inside both signal functions:

int signalBar = iBarShift(NULL, 0, PatternBarTime);
SellArrowBuffer[signalBar] = arrowPrice;

and

BuyArrowBuffer[signalBar] = arrowPrice;
What happens

A pattern is detected using older bars.

Confirmation happens later when the price closes beyond a level.

When confirmation occurs, the arrow is drawn on the earlier pattern bar (PatternBarTime).

So the chart ends up showing an arrow several bars earlier than when the signal was actually known.

Result

In live trading:

No arrow exists initially.

A few bars later, confirmation happens.

Then the arrow suddenly appears on an older candle.

This is classic backpainting.

2️⃣ Pattern invalidation can remove signals

These sections also contribute:

if(High[currentBar] > PatternHigh)
ResetPattern();

and

if(Low[currentBar] < PatternLow)
ResetPattern();

If a pattern is detected but later invalidated, the stored pattern is wiped.

Because the algorithm scans multiple bars each recalculation, historical outcomes can differ depending on what the future bars did.

3️⃣ Global state variables make historical recalculation unstable

These variables are global:

bool IsLookingForSellSignal;
int PatternBarTime;
double PatternHigh;
double PatternLow;

But the indicator loops through many bars every tick:

for(int i = barsToCalculate; i > 0; i--)

So the internal state depends on the order of historical processing, which can change when:

refreshing chart

switching timeframe

switching symbol

history updates

That means signals can shift or disappear after recalculation.

4️⃣ Arrows are cleared after every calculation

Each bar starts with:

BuyArrowBuffer = 0;
SellArrowBuffer = 0;

So signals are recomputed from scratch every tick, not locked once produced.

📊 Final verdict
Behavior Result
Arrow plotted on earlier bar after confirmation ⚠️ Backpainting
Signal can appear several bars later ⚠️ Repaint effect
State variables recalculated ⚠️ Possible signal shifting
Signals recalculated every tick ⚠️ Not stable historically

✅ Conclusion:
This indicator repaints/backpaints because it draws signals on past bars after future confirmation.
These users thanked the author BeatlemaniaSA for the post (total 3):
rosy440, Krunal Gajjar, Abdi
Millionaire Maker - “Amateurs chase. Professionals wait. Legends wait with a plan.”

BEATS V5 - "Enjoy The Quiet Between Trades”
Improve Your Trading Psychology - No fear, no doubt
Ultimate Risk Management - Maximize Your Trades
Supply and Demand Course - Learn Supply and Demand
Believe That You Can - Believe That You Can

Re: Something interesting please post here (Metatrader)

4317
Intrest 1 wrote: Sun Mar 15, 2026 6:31 pm.
"Does the indicator repaint?"

Yes, this indicator does repaint. Let me explain exactly why, because the repainting is subtle and comes from the logic rather than typical future-bar indexing.

1️⃣ The arrow is drawn on a past bar after future confirmation

The key repainting line is here inside both signal functions:

int signalBar = iBarShift(NULL, 0, PatternBarTime);
SellArrowBuffer[signalBar] = arrowPrice;

and

BuyArrowBuffer[signalBar] = arrowPrice;
What happens

A pattern is detected using older bars.

Confirmation happens later when the price closes beyond a level.

When confirmation occurs, the arrow is drawn on the earlier pattern bar (PatternBarTime).

So the chart ends up showing an arrow several bars earlier than when the signal was actually known.

Result

In live trading:

No arrow exists initially.

A few bars later, confirmation happens.

Then the arrow suddenly appears on an older candle.

This is classic backpainting.

2️⃣ Pattern invalidation can remove signals

These sections also contribute:

if(High[currentBar] > PatternHigh)
ResetPattern();

and

if(Low[currentBar] < PatternLow)
ResetPattern();

If a pattern is detected but later invalidated, the stored pattern is wiped.

Because the algorithm scans multiple bars each recalculation, historical outcomes can differ depending on what the future bars did.

3️⃣ Global state variables make historical recalculation unstable

These variables are global:

bool IsLookingForSellSignal;
int PatternBarTime;
double PatternHigh;
double PatternLow;

But the indicator loops through many bars every tick:

for(int i = barsToCalculate; i > 0; i--)

So the internal state depends on the order of historical processing, which can change when:

refreshing chart

switching timeframe

switching symbol

history updates

That means signals can shift or disappear after recalculation.

4️⃣ Arrows are cleared after every calculation

Each bar starts with:

BuyArrowBuffer = 0;
SellArrowBuffer = 0;

So signals are recomputed from scratch every tick, not locked once produced.

📊 Final verdict
Behavior Result
Arrow plotted on earlier bar after confirmation ⚠️ Backpainting
Signal can appear several bars later ⚠️ Repaint effect
State variables recalculated ⚠️ Possible signal shifting
Signals recalculated every tick ⚠️ Not stable historically

✅ Conclusion:
This indicator repaints/backpaints because it draws signals on past bars after future confirmation.
Millionaire Maker - “Amateurs chase. Professionals wait. Legends wait with a plan.”

BEATS V5 - "Enjoy The Quiet Between Trades”
Improve Your Trading Psychology - No fear, no doubt
Ultimate Risk Management - Maximize Your Trades
Supply and Demand Course - Learn Supply and Demand
Believe That You Can - Believe That You Can

PBF Scalper non-repainting and enhanced with MTF averaging filter

4318
PBF Scalper non-repainting and enhanced with MTF averaging filter (and MTF trend line)

Beatle 🪲

P.S. Important: Be aware that if you set the MTFHTF filter to anything higher than the current chart, the arrows can appear and disappear until the HTF candle closes. This is the nature of MTF. So you have been warned. ;)
Millionaire Maker - “Amateurs chase. Professionals wait. Legends wait with a plan.”

BEATS V5 - "Enjoy The Quiet Between Trades”
Improve Your Trading Psychology - No fear, no doubt
Ultimate Risk Management - Maximize Your Trades
Supply and Demand Course - Learn Supply and Demand
Believe That You Can - Believe That You Can

Re: PBF Scalper non-repainting and enhanced with MTF averaging filter

4319
BeatlemaniaSA wrote: Sun Mar 15, 2026 7:21 pm PBF Scalper non-repainting and enhanced with MTF averaging filter (and MTF trend line)

PBF Scalper.ex4

PBF Scalper.mq4

PBF Scalper MTF.jpg

PBF Scalper MTF 15min.jpg

PBF Scalper MTF 15min 2.jpg

Beatle 🪲

P.S. Important: Be aware that if you set the MTFHTF filter to anything higher than the current chart, the arrows can appear and disappear until the HTF candle closes. This is the nature of MTF. So you have been warned. ;)
MT5 please

Re: PBF Scalper non-repainting and enhanced with MTF averaging filter

4320
TriThep wrote: Mon Mar 16, 2026 11:21 pm MT5 please
You have the source code. Ask GROk, CharGPT or any other AI to do it for you.
These users thanked the author BeatlemaniaSA for the post:
Lucas
Millionaire Maker - “Amateurs chase. Professionals wait. Legends wait with a plan.”

BEATS V5 - "Enjoy The Quiet Between Trades”
Improve Your Trading Psychology - No fear, no doubt
Ultimate Risk Management - Maximize Your Trades
Supply and Demand Course - Learn Supply and Demand
Believe That You Can - Believe That You Can