Im using the following code to trigger a buy order. What Im doing is looking for an outside candle, where the low of the current candle dips below the low of the previous candle....and then the high of the current candle breaches the high of previous candle. The following logic only works if its an outside candle. (i-e, current low is less than prev low, and current high is higher than prev high)
[code]bool buy_condition_1 = Low <= Low;
bool buy_condition_2 = Ask == High ;
if( buy_condition_1 && buy_condition_2).................(buy at current ask)
What i want to do is that if the current low is less than prev low, then set the buy price at the high...and hold that buy price until it is hit. In the above code, the price is hit only if its an outside candle, and as soon as a new candle is formed, the value of High shifts to the new candle as well. I want value of High to remain fixed.
bool buy_condition_1 = Low <= Low;
if( buy_condition_1 )OrderSend(Symbol(), OP_BUYSTOP,1,High,50,50);
Thanks Adam...but that didnt seem to help.
I guess i can set the value by declaring it as a static double, but my next question would be, how would i reset its value, should i need to change it? Is there a way to reset the value of a static variable mid strategy, so as to assign in a new value?.