NexusFi: Find Your Edge


Home Menu

 





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


Discussion in MultiCharts

Updated
    1. trending_up 4,755 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread

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

  #11 (permalink)
risaldeb
Hong Kong
 
Posts: 10 since Feb 2015
Thanks Given: 1
Thanks Received: 0


Jura View Post
You can use BarStatus to ensure that `var0` is calculated on bar close and not on every tick. For example:

 
Code
Variables:
  var0(0),
  buyOrder(false);

if (BarStatus(1) = 2) then begin

  // Calculate var0 on bar close
  var0 = ...
  
  // Generate the order condition
  if (Low > var0) then
    buyOrder = true;

end;

// This code is executed on every tick
if (buyOrder = true) then begin

  // Submit order

end;

Hi Jura,

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]?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Strategy stop orders partially filled
EasyLanguage Programming
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
33 thanks
Just another trading journal: PA, Wyckoff & Trends
23 thanks
Trading with Intuition
18 thanks
Self sabotage reframed
14 thanks
GFIs1 1 DAX trade per day journal
9 thanks
  #12 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


risaldeb View Post
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).

Reply With Quote
  #13 (permalink)
risaldeb
Hong Kong
 
Posts: 10 since Feb 2015
Thanks Given: 1
Thanks Received: 0



Jura View Post
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;

Reply With Quote
  #14 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


risaldeb View Post
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:

 
Code
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;

Reply With Quote
  #15 (permalink)
risaldeb
Hong Kong
 
Posts: 10 since Feb 2015
Thanks Given: 1
Thanks Received: 0


Jura View Post
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:

 
Code
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;


end;

Reply With Quote




Last Updated on May 27, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts