I'm trying to create a code for scaling in to a position.
After the first entry I want to use the ATR value (of the entrybar) for scaling in the next contract.
Something like:
Code: Select all
Value1 = 1250;
if CurrentEntries = 0 then
BuyPrice = Value1 ;
ATR = AvgTrueRange(14);
if CurrentEntries = 0 then begin
Buy 1 Contract next bar at BuyPrice + 1 Point Stop;
Buy 1 Contract next bar at BuyPrice + 1 Point + (ATR*2) Stop;
end
else if CurrentEntries = 1 then
Buy 1 Contract next bar at BuyPrice + 1 Point + (ATR*2) Stop;
(It is not 1250 + 1 Point + ATR*2)
Even if the second entry is 20 bars later I still want to use the ATR value at the first entrybar.
I don't know if it's because the ATR isn't calculated from the first entrybar or if anything else is wrong.
Hope someone can help.
Thanks, Lars