Instead of doing this:
if currentshares = LTT then begin buy("B-20A.5") LTT shares next bar highest(h,20)[BB] + (0.5*N) or higher; buy("B-20A 1") LTT shares next bar highest(h,20)[BB] + (1.0*N) or higher; buy("B-20A1.5") LTT shares next bar highest(h,20)[BB]+ (1.5*N) or higher; end; if currentshares = LTT * 2 then begin buy("B-20B 1") LTT shares next bar highest(h,20)[BB] + (1.0*N) or higher; buy("B-20B1.5") LTT shares next bar highest(h,20)[BB] + (1.5*N) or higher; end; if currentshares = LTT * 3 then buy("B-20C1.5") LTT shares next bar highest(h,20)[BB] + (1.5*N) or higher; end;
Just do this:
for iCnt = 0 to 3 begin if lastTradeLoser then begin if mp <> -1 and currentContracts = iCnt * lotSize then begin buyPrice = hh20 + iCnt * N/2; end; end; end; if lastTradeLoser then begin if currentContracts < 4 * lotsize then Buy ("Turtle20Buy") lotSize contracts next bar at buyPrice stop; end;
Instead of having multiple buy orders at different levels -simply change your buy levels using the for-next loop and issue just one order. Only problem is you can only issue one buy order per bar. Whereas the former approach will place multiple orders for the next bar. Usually this will not cause a problem unless your buy/sell levels are very close. The use of the for-next loop is up to one's own programming style. I like the for-next loop.