Have not seen this Strategy script on the site, it was posted on United Traders Discord as a TOS link. I have been looking for a non-repainting strategy and so far it seems to be working. http://tos.mx/bh2x4F called the MoneyMaker, it is basically EMA crossovers. there are some interesting AddOrder statements that I think make the code profitable and non repaint. They may also may make the results less than real. I was experimenting with NQ on 5 min, last 20 day, over 60K in the backtest. As I said in real life you probably wont get the fills it has. But many people are looking for non-repaint script. You can ignore the first section which is a zigzag reference, because it is not actually part of the strategy. I'm posting it as it is written in the link, there are no listed contributors. Try it out and give your opinions.
Code:
#ZigZag
def price = close;
input ReversalAmount = 0.1;
def "ZZ$" = reference ZigZagHighLow(price, price, 0, ReversalAmount, 1, 0);
def zzSave = if !IsNaN("ZZ$") then price else GetValue(zzSave, 1);
def chg = price - GetValue(zzSave, 1);
def Up = if !IsNaN("ZZ$") and chg > 0 then chg else no;
def CountUp = if Up then 1 else 0;
def CountUpN = Sum(CountUp, 1950);
def CountUpTotal = if Up then chg else 0;
def CountUpTotalN = Sum(CountUpTotal, 1950);
def UpAverage = CountUpTotalN / CountUpN;
def Down = if !IsNaN("ZZ$") and chg < 0 then chg else no;
def CountDown = if Down then 1 else 0;
def CountDownN = Sum(CountDown, 1950);
def CountDownTotal = if Down then chg else 0;
def CountDownTotalN = Sum(CountDownTotal, 1950);
def DownAverage = CountDownTotalN / CountDownN;
#ATR
def ATRlength = 14;
def averageType = AverageType.WILDERS;
def averageType2 = AverageType.EXPONENTIAL;
def ATR = MovingAverage(averageType, TrueRange(high, close, low), ATRlength);
def AVGATR = MovingAverage(averageType2, ATR, 50);
def UpAverage2 = AVGATR;
def DownAverage2 = (AVGATR*-1);
#Movavgs
plot E5 = MovAvgExponential(close, 5);
E5.SetDefaultColor(Color.GREEN);
plot E10 = MovAvgExponential(close, 10);
E10.SetDefaultColor(Color.YELLOW);
plot E20 = MovAvgExponential(close, 20);
E20.SetDefaultColor(Color.RED);
#TradeSize
input tradesize = 1000;
#Risk/Loss
Input RiskRatio = 2;
#Timeframe
def time = SecondsFromTime(0930) >= 0 and SecondsTillTime(1600) > 0;
#Crosses
def CloseCrossLong = Crosses(Close, E20, CrossingDirection.ABOVE);
def CloseCrossShort = Crosses(Close, E20, CrossingDirection.BELOW);
def HighCross = Crosses(High, E20, CrossingDirection.ABOVE) or High equals E20;
def LowCross = Crosses(Low, E20, CrossingDirection.BELOW) or Low equals E20;
def POS = if E5 > E10 then no else yes;
def NEG = if E5 < E10 then no else yes;
def HighOpen = if HighCross then yes else no;
def LowOpen = if LowCross then yes else no;
def LongOpen = if CloseCrossLong then yes else no;
def ShortOpen = if CloseCrossShort then yes else no;
#--------------------------------------------------------------------------------------------------------------------
AddOrder(OrderType.BUY_TO_OPEN,
if (HighOpen and NEG) or (LowOpen and E5 > E10 and E10 > E20) or (LongOpen and NEG) then yes else no,
if (HighOpen and NEG) or (LowOpen and E5 > E10 and E10 > E20) then E20 else OPEN[-1], tradesize, tickcolor = Color.GREEN, arrowcolor = Color.GREEN);
AddOrder(OrderType.SELL_TO_CLOSE, if (high >= (EntryPrice() + RoundDown(UpAverage2))) within 5 bars and Crosses(close, E10, CrossingDirection.BELOW) then yes else no, OPEN[-1], tradesize, tickcolor = Color.RED, arrowcolor = Color.RED);
AddOrder(OrderType.SELL_TO_CLOSE, if (low <= (EntryPrice() - RoundUp(UpAverage2/RiskRatio))) then yes else no, (EntryPrice() - RoundUp(UpAverage2/RiskRatio)), tradesize, tickcolor = Color.RED, arrowcolor = Color.RED);
Def Stop = RoundUp(UpAverage2 / -RiskRatio);
AddLabel(1, "LONG: " + Long, Color.LIGHT_GREEN);
AddLabel(1, "STOP: " + Stop, Color.LIGHT_GREEN);
AddOrder(OrderType.SELL_TO_OPEN,
if (LowOpen and POS) or (HighOpen and E5 < E10 and E10 < E20) or (ShortOpen and POS) then yes else no,
if (LowOpen and POS) or (HighOpen and E5 < E10 and E10 < E20) then E20 else OPEN[-1], tradesize, tickcolor = Color.MAGENTA, arrowcolor = Color.MAGENTA);
AddOrder(OrderType.BUY_TO_CLOSE, if (low <= (EntryPrice() + RoundDown(DownAverage2))) within 5 bars and Crosses(close, E10, CrossingDirection.ABOVE) then yes else no, OPEN[-1], tradesize, tickcolor = Color.CYAN, arrowcolor = Color.CYAN);
AddOrder(OrderType.BUY_TO_CLOSE, if (high >= (EntryPrice() - RoundUp(DownAverage2/RiskRatio))) then yes else no, (EntryPrice() - RoundUp(DownAverage2/RiskRatio)), tradesize, tickcolor = Color.CYAN, arrowcolor = Color.CYAN);
Def Short = RoundDown(DownAverage2);
Def Cover = RoundUp(DownAverage2 / -RiskRatio);
AddLabel(1, "SHORT: " + Short, Color.LIGHT_RED);
AddLabel(1, "COVER: " + Cover, Color.LIGHT_RED);
Last edited by a moderator: