if I set a variable (previously declared as private double variable1 = 0; in the Variable section) to a fixed value at the time I enter a trade in the onBarUpdate() method as described below
if(Close[0] > Close[1]) { [B]double variable1 = High[0] - Low[0]; [/B] entryOrder = EnterLongLimit(0,false,1,Close[0],"Buy"); }
Assuming after 10 bars in the trade I call this variable to adjust my stop (code below), would this be still the same value set at the time I entered the trade?
if(Close[0] > High[1] + [B]variable1[/B]) stopOrder = ExitLongStop(0,true,1,Close[0]+variable1,"TrailingStop",Buy");
Comment