Easylanguage/Multicharts still buying next bar even no more code to buy signal!

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:

We work extremely hard to keep things positive on our forums.

We do not tolerate rude behavior, trolling, or vendor advertising in posts.

We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.

We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

Sorry to bother you again. I am trying to fully understand the BarStatus function and so I tried below code to see if it works for me but unfortunately it did not react as I expected.

If (BarStatus(1) = 1) and (BarStatus(2) = 1) then begin//I am assuming BarStatus(1) is same as Bar[1] etc...correct?
Gap1= high[2]*GapUp;
if (low[1]>Gap1) and (close<high[1]) then
FalseGapUp1=True;
End;
If (BarStatus(1) = 1) and (BarStatus(2) = 1) and (BarStatus(3) = 1) then begin
Gap2= high[3]*GapUp;
if (low[2]>Gap2) and (close<low[1]) then
FalseGapUp2=True;
End;

Is my assumption that BarStatus(1) is the same as Bar[1]? If not how can I code if IOG=true and I like to use 30 minutes Bar[3], Bar[2] and Bar[1]?

Follow the link in my previous post for more information about `BarStatus`; your assumption is not correct I'm afraid.

By the way, previous bars (i.e., bars that have closed) will always have a `BarStatus` value of 2 (= closed).

OMG! So how can I code it then with the following logic if IOG = True. Here's what I wanted to achieve if IOG=False but I like it to function under IOG=True. This strategy is to determine when there is a false gap up of 30 minutes bar.

Gap1= high[2]*GapUp;//Gap occurs the previous 30 min bar.
if (low[1]>Gap1) and (close<high[1]) then
FalseGapUp1=True;
End;

Gap2= high[3]*GapUp;// gap occurs the previous 2 30 min bars.
if (low[2]>Gap2) and (close<low[1]) then
FalseGapUp2=True;
End;

Here's what I wanted to achieve if IOG=False but I like it to function under IOG=True.

If code should work under IOG the same way as without IOG, all you need to do is add the `BarStatus` keyword since the only difference between IOG and non-IOG is whether the prices are processed intra-bar (IOG) or just on bar close (non-IOG).

So making your code behave in the same way with IOG enabled as it did with IOG disabled would be:

if (BarStatus(1) = 2) then begin
Gap1= high[2]*GapUp;//Gap occurs the previous 30 min bar.
if (low[1]>Gap1) and (close<high[1]) then
FalseGapUp1=True;
End;
Gap2= high[3]*GapUp;// gap occurs the previous 2 30 min bars.
if (low[2]>Gap2) and (close<low[1]) then
FalseGapUp2=True;
End;
end;

If code should work under IOG the same way as without IOG, all you need to do is add the `BarStatus` keyword since the only difference between IOG and non-IOG is whether the prices are processed intra-bar (IOG) or just on bar close (non-IOG).

So making your code behave in the same way with IOG enabled as it did with IOG disabled would be:

if (BarStatus(1) = 2) then begin
Gap1= high[2]*GapUp;//Gap occurs the previous 30 min bar.
if (low[1]>Gap1) and (close<high[1]) then
FalseGapUp1=True;
End;
Gap2= high[3]*GapUp;// gap occurs the previous 2 30 min bars.
if (low[2]>Gap2) and (close<low[1]) then
FalseGapUp2=True;
End;
end;

Many Thanks Again Jura, You make my day happy once again. Your help works. I just tweaked a little and it perfectly work according to my liking. Here is what I did.

if (BarStatus(1) = 1) then begin

Gap1= high[2]*GapUp;//Gap occurs the previous 30 min bar.
if (low[1]>Gap1) and (close<high[1]) then
FalseGapUp1=True;

Gap2= high[3]*GapUp;// gap occurs the previous 2 30 min bars.
if (low[2]>Gap2) and (close<low[1]) then
FalseGapUp2=True;