Prevent opening new trades if existing trade exist
Posted: Mon Jan 16, 2017 10:29 am
Hello, thanks for a great site!
So I'm struggling with this snippet and valuemap.BuySell ~= "B" in this block of code:
if core.crossesOver(FMADATA, 1.05100, p - FMASHIFT)
and valuemap.BuySell ~= "B"
then enter("B"); -- enter long trade
end
Logic: if ema is equal to value 1.05100 and no existing open buy trade exists, then open buy trade.
(not sure what argument to put so I've put in and valuemap.BuySell ~= "B" but it isn't working, go figure) everything else works.
So I'm struggling with this snippet and valuemap.BuySell ~= "B" in this block of code:
if core.crossesOver(FMADATA, 1.05100, p - FMASHIFT)
and valuemap.BuySell ~= "B"
then enter("B"); -- enter long trade
end
Logic: if ema is equal to value 1.05100 and no existing open buy trade exists, then open buy trade.
(not sure what argument to put so I've put in and valuemap.BuySell ~= "B" but it isn't working, go figure) everything else works.