Manual back testing produced over 1000 pips in approx 3 months
~~If D_Oscillator Buff1<Buff2 place sell entry order on low fractal or if D_Oscillator Buff1>Buff2 place buy entry order on high fractal. Stop will be opposing fractal.~~
- Code: Select all
function Init() --The strategy profile initialization
strategy:name("Fractal Gain Strategy");
strategy:description("Fractal Gain Strategy ");
strategy.parameters:addGroup("D oscillator parameters");
strategy.parameters:addString("TF", "Time Frame", "", "H4"); --D-Oscillator trend time frame--
strategy.parameters:addInteger("RSI_Period", "RSI_Period", "", 21);
strategy.parameters:addInteger("D_Period", "D_Period", "", 15);
strategy.parameters:addInteger("CCI_Period", "CCI_Period", "", 21);
strategy.parameters:addDouble("CCI_Coeff", "CCI_Coeff", "", 0.4);
strategy.parameters:addInteger("Smooth", "Smooth", "", 20);
strategy.parameters:addGroup("Margin Requirements");
strategy.parameters:addBoolean("UseMargin", "Use Margin To Control Trades", "", true);
strategy.parameters:addInteger("StopMargin", "Percentage to stop adding new trades", "", 90, 1, 100)
strategy.parameters:addGroup("Trading Parameters");
strategy.parameters:addBoolean("AllowTrade", "Allow strategy to trade", "", false);
strategy.parameters:addString("Period", "Chart Time Frame", "", "H2"); --Time frame for trade excution--
strategy.parameters:addString("Account", "Account to trade on", "", "");
strategy.parameters:setFlag("Account", core.FLAG_ACCOUNT);
strategy.parameters:addString("TradeType", "Use Balance or Fixed Lot", "", "Bal");
strategy.parameters:addStringAlternative("TradeType", " FixedLot ", "", "FL");
strategy.parameters:addStringAlternative("TradeType", "Balance", "", "Bal");
strategy.parameters:addInteger("Amount", "Trade Amount in Lots", "", 1, 1, 1000);
strategy.parameters:addInteger("DividedBy", "Amount Of Account To Use", "", 3%, .1%, 50%);
~~Bal Formula =ROUNDDOWN((Balance*DividedBy)/MMR,0,.01))(Example: Balance is $50000.00 you wish to use 5% of balance= $2500.00 divide by MMR of EUR $30.00=83.333 mirco lots rounded down to 83)~~
strategy.parameters:addBoolean("SetLimit", "Set Limit Orders", "", false);
strategy.parameters:addInteger("Limit", "Limit Order in pips", "", 30, 1, 10000);
strategy.parameters:addGroup("Fractal Parameters");
strategy.parameters:addInteger("Frame", "Number of bars for fractals (Odd)", "", 5, 3, 99);
strategy.parameters:addGroup("Stop Parameters");
strategy.parameters:addInteger("Indent", "Indent from fractal", "", 0, 0, 1000);
strategy.parameters:addBoolean("MoveBack", "Move stop back", "", false);
strategy.parameters:addString("Type", "Price type", "", "Auto");
strategy.parameters:addStringAlternative("Type", "Bid", "", "Bid");
strategy.parameters:addStringAlternative("Type", "Ask", "", "Ask");
strategy.parameters:addStringAlternative("Type", "Auto", "", "Auto");~~buy=bid sell=ask~~
strategy.parameters:addString("FPeriod", "Timeframe", "", "m15"); --Fractal time frame--
strategy.parameters:addInteger("Timeout", "How often to check stop (in seconds)", "", 60, 1, 60);--Check for stop; if no stop set stop on fractal--
strategy.parameters:addGroup("Notification");
strategy.parameters:addBoolean("ShowAlert", "Show Alert", "", false);
strategy.parameters:addBoolean("PlaySound", "Play Sound", "", false);
strategy.parameters:addBoolean("RecurSound", "Recurrent Sound", "", false);
strategy.parameters:addString("SoundFile", "Sound File", "", "");
strategy.parameters:setFlag("SoundFile", core.FLAG_SOUND);
strategy.parameters:addBoolean("SendEmail", "Send Email", "", false);
strategy.parameters:addString("Email", "Email", "", "");
strategy.parameters:setFlag("Email", core.FLAG_EMAIL);