4x4partners wrote:In reference to my above issue regarding BREAKEVENALL:
I modified a few lines in ExtUpdate in order to check to see if the current stop is better than breakeven. Seems to work.
If anyone wants the code, I've pasted it below.
Basically replace these 5 lines:
- Code: Select all
if (tradeRow.IsBuy) then
stopValue = openPrice + (gap * instance.bid:pipSize());
elseif (not tradeRow.IsBuy) then
stopValue = openPrice - (gap * instance.bid:pipSize());
end
With the below, which adds the additional check:
- Code: Select all
if (tradeRow.IsBuy) then
stopValue = openPrice + (gap * instance.bid:pipSize());
-- check if the stop is better than the BreakEven level, if so, do nothing and exit
if stopValue < tradeRow.Stop then
return;
end
elseif (not tradeRow.IsBuy) then
stopValue = openPrice - (gap * instance.bid:pipSize());
-- check if the stop is better than the BreakEven level, if so, do nothing and exit
if stopValue > tradeRow.Stop then
return;
end
end
hello there,
thank you very much for the code.
i seached long time for this through the net.
but i have one problem.
if i insert this in my script it works fine for long trades.
but not for short.
the strategy doesnt set a stop.
i edit a little bit the code but nothing worked.
can someone please help me?
best regards
lux