Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Easylanguage/Multicharts still buying next bar even no more code to buy signal!
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]?
Can you help answer these questions from other members on NexusFi?
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;