Here is my min scalper.
Buy side only.
Works pretty well in most time frames
Only issue I have is it needs monitoring as sometimes the stop level – which initially shows up fine occasionally disappears. Not sure where I have got the code wrong here!
Any help with this would be appreciated.
The stop order is disapearring because pending order only last one bar, and you put it only one time when you trigger the buy at market order. In the code below, I moved it outside of this conditional block and create a new one where the pending order will be placed continuously and only if we are on market.
//Mini reversal
DEFPARAM CumulateOrders = True //
DEFPARAM Preloadbars = 1000
DEFPARAM Flatbefore = 080000
DEFPARAM Flatafter = 210000
DaysForbiddenEntry = OpenDayOfWeek = 5 OR OpenDayOfWeek = 0
x = 4// bar height
// Conditions to enter Long positions
c1 = Close[0] > Close[1] + (Open[1] - Close[1]) * 0.9
c2 = Close[0] < Open[2] - (Open[2] - Close[2]) * 0.9
c3 = (Open[3] - Close[3]) > x
c4 = (Open[2] - Close[2]) > x
c5 = (Open[1] - Close[1]) > x
c6 = Close[0] > Open[0]
Once Downstop = 1
Once Uptarget = 1
If c1 and c2 and c3 and c4 and c5 and c6 and not DaysForbiddenEntry then
BUY 10 lots at Market
Uptarget = abs(Open[1] - Close[0])
Downstop = Lowest[2](low) - 1
Set Target pProfit Uptarget
Endif
if onmarket then
Sell at Downstop stop
endif