Hi, I want to go long directly when an outside bar is formed. When previous bar low has already been taken out I want to go long one tick above the prevoius bar high. I use IntrabarOrderGeneration and Bar Magnifier in Multicharts.
The problem is that sometime Multicharts goes long despite the outside bar is formed the opposite way (high first and low thereafter). What may the solution be? Is there a way to code to ensure that Multicharts checks in which chronological order low and high of previous bar is exceeded?
If Marketposition = 0 AND L<L Then Buy next bar at H + 0.0001 or higher ;
If Marketposition = 1 then sell next bar at entryprice + PTlong or higher;
If Marketposition = 1 then sell this bar at Close;
Last edited by Orjan; December 27th, 2014 at 10:36 AM.
Multicharts did exactly what you coded - how should it know that you want the low to be taken out first when you didn't program that?
Having said that, you can use a boolean variable that you set to true when Close < Low (of course the variable needs to be intrabarpersist and you need to use the bar magnifier). Then you can use this variable's value in your entry condition check. On a new bar you simply set this variable back to false.
This will do what you have in mind.
The following user says Thank You to ABCTG for this post:
Thanks. The problem was that when I made the manual check of the trades I was not aware of at which time the sessions breaks between days are set in the chart. They are set to 17.00. So now my code seems to be doing what I want.