Big Three Trading Strategy
Forums › ProRealTime English forum › ProOrder support › Big Three Trading Strategy
- This topic has 9 replies, 4 voices, and was last updated 6 years ago by BC.
-
-
06/10/2017 at 2:39 PM #37978
I found this strategy via below link and use my limited knowledge translate to PRT robot, please kindly try, comment and feel free modify to fit for your need.
http://www.tradingstrategyguides.com/big-three-trading-str
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257// Big Three Trading Strategy// Original Idea from: http://www.tradingstrategyguides.com/big-three-trading-strategy/// Market: DAX 30// Time Frame: 1 Hour// Time Zone: Any// Spread: 2.9// Version : V 2.0defparam preloadbars = 3000defparam cumulateorders =false //true //false//// Core Indicator Parameter Setting ////// Moving Average Setting (Original: 20, 40, 80)Fast = 20 //Medium = 40 //Slow = 80 //// Look Back Bar (Original: N/A)CP = 3 // 1-20//// Optional Function Switch ( 1 = Enable 0 = Disable ) ////FixedMinMaxStopLoss = 1TargetProfit = 1TimeExit = 1MFETrailing = 1MoneyManagement = 0//// Optional Function and Parameter Setting ////// 1) Fixed Min Max Stop Loss SettingIf FixedMinMaxStopLoss = 1 then//LongMaxLong = 80 // 40-100 (90) 80MinLong = 30 // 5-30 (30) 30//ShortMaxShort = 60 // 40-100 (50) 60MinShort = 5 // 5-30 (10) 5Endif// 2) Take Profit SettingIf TargetProfit = 1 then//LongTakeProfitLongRate = 2.5 // 1-5//ShortTakeProfitShortRate = 2.5 // 1-5Endif// 3) Time Exit SettingIf TimeExit = 1 then//LongONCE maxCandlesLongWithProfit = 78 // 12-120 (72)ONCE maxCandlesLongWithoutProfit = 66 // 12-72 (72)//ShortONCE maxCandlesShortWithProfit = 60 // 12-96 (60)ONCE maxCandlesShortWithoutProfit = 54 // 12-48 (48)Endif// 4) MFE Step SettingIf MFETrailing = 1 then//LongMFELongStep = 1.5 // 2-12 2//ShortMFEShortStep = 1 // 2-12 9Endif// 5) Money ManagementIf MoneyManagement = 1 thenLongRisk = 5 //% 1-5ShortRisk = 3 //% 1-5CloseBalanceMaxDrop = 50 //% 30-60Capital = 2000 //$Equity = Capital + StrategyProfitLongMaxRisk = Round(Equity*LongRisk/100)ShortMaxRisk = Round(Equity*ShortRisk/100)//Max ContractMaxLongContract = 500 // 50-100 (1000)MaxShortContract = 100 // 10-50 (200)//Check system account balanceIf equity<QuickLevel thenQuitEndifRecordHighest = MAX(RecordHighest,Equity)QuickLevel = RecordHighest*((100-CloseBalanceMaxDrop)/100)Endif// Core indicator//Big Three MAFMA = Average[Fast](close) //green coloured(0,255,0)MMA = Average[Medium](close)//blue coloured(0,0,255)SMA = Average[Slow](close)//red coloured(255,0,0)// Entry Rules//Buy SignalB1 = low > SMA and low>MMA and low>FMAB2 = high >= highest[CP](high)BC = B1 and B2//Buy CandleBC1 = Close[1] < Close[2]BC2 = Close > Close[1]BC3 = Close > OpenBCandle = BC1 and BC2 and BC3//Sell SignalS1 = high < FMA and high<MMA and high<SMAS2 = low <= lowest[CP](low)SC = S1 and S2//Sell CaandleSC1 = Close[1] > Close[2]SC2 = Close < Close[1]SC3 = Close < OpenSCandle = SC1 and SC2 and SC3// Exit RulesLongExit = Close crosses under SMAShortExit = Close crosses over SMA//Long EntryIf BC and BCandle thenBuyPrice = CloseIf FixedMinMaxStopLoss = 1 thenStopLossLong = MIN(MaxLong,MAX(MinLong,(BuyPrice - SMA)))ElseStopLossLong = BuyPrice - SMAEndifIf TargetProfit = 1 thenTakeProfitLong = StopLossLong * TakeProfitLongRateTakeProfit = TakeProfitLongEndifIf MoneyManagement = 1 thenPositionSizeLong = min(MaxLongContract,(max(1,abs(round((LongMaxRisk/StopLossLong)/PointValue)*pipsize))))BUY PositionSizeLong CONTRACT AT MARKETElseBUY 1 CONTRACT AT MARKETEndifEndif//Long ExitIf LongonMarket and LongExit thensell at marketEndif//short entryIf SC and SCandle thenSellPrice = CloseIf FixedMinMaxStopLoss = 1 thenStopLossShort = MIN(MaxShort,MAX(MinShort,(SMA - SellPrice)))ElseStopLossShort = SMA - SellPriceEndifIf TargetProfit = 1 thenTakeProfitShort = StopLossShort * TakeProfitShortRateTakeProfit = TakeProfitShortEndifIf MoneyManagement = 1 thenPositionSizeShort = min(MaxShortContract,(max(1,abs(round((ShortMaxRisk/StopLossShort)/PointValue)*pipsize))))SELLSHORT PositionSizeShort CONTRACT AT MARKETElseSELLSHORT 1 CONTRACT AT MARKETEndifEndif//Short ExitIf ShortonMarket and ShortExit thenexitshort at marketEndif// Time ExitIf TimeExit = 1 thenIf LongonMarket thenposProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsizeelsif ShortonMarket thenposProfit = (((positionprice - close) * pointvalue) * countofposition) / pipsizeEndifm1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfitm2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfitm3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfitm4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit// take profit after max candlesIF LONGONMARKET AND (m1 OR m3) THENsell at marketendifIF SHORTONMARKET AND (m2 OR m4) THENexitshort at marketendifEndif//MFE Trailing stopIf MFETrailing = 1 thenMFELong = (TakeProfitLong/MFELongStep)MFEShort = (TakeProfitShort/MFEShortStep)If not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0EndifIf longonmarket thenMAXPRICE = MAX(MAXPRICE,close)If MAXPRICE-tradeprice(1)>=MFELong*pointsize thenpriceexit = MAXPRICE-MFELong*pointsizeEndifEndifIf shortonmarket thenMINPRICE = MIN(MINPRICE,close)If tradeprice(1)-MINPRICE>=MFEShort*pointsize thenpriceexit = MINPRICE+MFEShort*pointsizeEndifEndifIf onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPEndifEndif// Stop Lossif LongonMarket thenSET STOP LOSS StopLossLongendifif ShortonMarket thenSET STOP LOSS StopLossShortendif// Target ProfitIf TargetProfit = 1 thenSET TARGET PROFIT TakeProfitEndif//graph BuyPrice//graph SellPrice//graph StopLossLong//graph StopLossShort11/13/2017 at 8:52 AM #5250711/13/2017 at 11:45 AM #5253411/13/2017 at 11:46 AM #5253511/13/2017 at 5:16 PM #5257111/13/2017 at 11:57 PM #5264111/14/2017 at 3:30 AM #52643Thank you Bin for the strategy. I like the neat and modular approach to your coding and hope you don’t mind me cutting and pasting so that I may use some of it in future ideas of my own!
As for being flat for the last few months…. it is a trend following strategy and markets haven’t really known which way to go recently with all the political turmoil so it is not really surprising to me that a trend reliant strategy has gone a bit flat.
Great work – thanks.
11/14/2017 at 6:51 AM #52647Hi Nicolas
Please kindly post this latest version to library with detailed remark which variables were optimized and their unit. THX.
Big Three Trading Strategy123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254// Big Three Trading Strategy// Original Idea from: http://www.tradingstrategyguides.com/big-three-trading-strategy/// Market: DAX 30// Time Frame: 1 Hour// Time Zone: Any// Spread: 2.9// Version : 2.8// Revised on 2017-11-14Defparam preloadbars = 3000Defparam cumulateorders =false //true //false//// Optional Function Switch ( 1 = Enable 0 = Disable ) ////FixedMinMaxStopLoss = 1 // Optional Function 1TargetProfit = 1 // Optional Function 2TimeExit = 1 // Optional Function 3MFETrailing = 1 // Optional Function 4MoneyManagement = 0 // Optional Function 5//// Core Indicator Parameter Setting ////// Moving Average Setting (Original: 20, 40, 80)Fast = 20 // Not OptimizeMedium = 40 // Not OptimizeSlow = 80 // Not Optimize// Look Back Bar (Original: N/A)CP = 3 // Variables Optimized//// Optional Function ////// 1) Fixed Min Max Stop Loss SettingIf FixedMinMaxStopLoss then//LongMaxLong = 80 // by points, Variables OptimizedMinLong = 30 // by points, Variables Optimized//ShortMaxShort = 60 // by points, Variables OptimizedMinShort = 5 // by points, Variables OptimizedEndif// 2) Take Profit SettingIf TargetProfit then//LongTakeProfitLongRate = 2.6 // by %, Variables Optimized//ShortTakeProfitShortRate = 2.5 // by %, Variables OptimizedEndif// 3) Time Exit SettingIf TimeExit then//LongONCE maxCandlesLongWithProfit = 78 // by bar, Variables OptimizedONCE maxCandlesLongWithoutProfit = 66 // by bar, Variables Optimized//ShortONCE maxCandlesShortWithProfit = 60 // by bar, Variables OptimizedONCE maxCandlesShortWithoutProfit = 54 // by bar, Variables OptimizedEndif// 4) MFE Step SettingIf MFETrailing then//LongMFELongStep = 1.5 // by %, Variables Optimized//ShortMFEShortStep = 1 // by %, Variables OptimizedEndif// 5) Money ManagementIf MoneyManagement thenLongRisk = 5 // by %, Variables OptimizedShortRisk = 3 // by %, Variables OptimizedCloseBalanceMaxDrop = 50 // by %, Personal preferenceCapital = 3000 // by $Equity = Capital + StrategyProfitLongMaxRisk = Round(Equity*LongRisk/100)ShortMaxRisk = Round(Equity*ShortRisk/100)//Max ContractMaxLongContract = 500 // by contract, Variables OptimizedMaxShortContract = 100 // by contract, Variables Optimized//Check system account balanceIf equity<QuitLevel thenQuitEndifRecordHighest = MAX(RecordHighest,Equity)QuitLevel = RecordHighest*((100-CloseBalanceMaxDrop)/100)Endif// Core indicator//Big Three MAFMA = Average[Fast](close) //green coloured(0,255,0)MMA = Average[Medium](close) //blue coloured(0,0,255)SMA = Average[Slow](close) //red coloured(255,0,0)// Entry Rules//Buy SignalB1 = low > SMA and low>MMA and low>FMAB2 = high >= highest[CP](high)BC = B1 and B2//Buy CandleBC1 = Close[1] < Close[2]BC2 = Close > Close[1]BC3 = Close > OpenBCandle = BC1 and BC2 and BC3//Sell SignalS1 = high < FMA and high<MMA and high<SMAS2 = low <= lowest[CP](low)SC = S1 and S2//Sell CandleSC1 = Close[1] > Close[2]SC2 = Close < Close[1]SC3 = Close < OpenSCandle = SC1 and SC2 and SC3// Exit RulesLongExit = Close crosses under SMAShortExit = Close crosses over SMA//Long EntryIf Not LongonMarket and BC and BCandle thenBuyPrice = CloseIf FixedMinMaxStopLoss thenStopLossLong = MIN(MaxLong,MAX(MinLong,(BuyPrice - SMA)))ElseStopLossLong = BuyPrice - SMAEndifIf TargetProfit thenTakeProfitLong = StopLossLong * TakeProfitLongRateTP = TakeProfitLongEndifSL = StopLossLongIf MoneyManagement thenPositionSizeLong = min(MaxLongContract,(max(2,abs(round((LongMaxRisk/StopLossLong)/PointValue)*pipsize))))BUY PositionSizeLong CONTRACT AT MARKETElseBUY 2 CONTRACT AT MARKETEndifEndif//Long ExitIf LongonMarket and LongExit thensell at marketEndif//short entryIf Not ShortonMarket and SC and SCandle thenSellPrice = CloseIf FixedMinMaxStopLoss thenStopLossShort = MIN(MaxShort,MAX(MinShort,(SMA - SellPrice)))ElseStopLossShort = SMA - SellPriceEndifIf TargetProfit thenTakeProfitShort = StopLossShort * TakeProfitShortRateTP = TakeProfitShortEndifSL = StopLossShortIf MoneyManagement thenPositionSizeShort = min(MaxShortContract,(max(2,abs(round((ShortMaxRisk/StopLossShort)/PointValue)*pipsize))))SELLSHORT PositionSizeShort CONTRACT AT MARKETElseSELLSHORT 2 CONTRACT AT MARKETEndifEndif//Short ExitIf ShortonMarket and ShortExit thenexitshort at marketEndif// Time ExitIf TimeExit thenIf LongonMarket thenposProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsizeelsif ShortonMarket thenposProfit = (((positionprice - close) * pointvalue) * countofposition) / pipsizeEndifm1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfitm2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfitm3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfitm4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit// take profit after max candlesIF LONGONMARKET AND (m1 OR m3) THENsell at marketendifIF SHORTONMARKET AND (m2 OR m4) THENexitshort at marketendifEndif//MFE Trailing stopIf MFETrailing thenMFELong = (TakeProfitLong/MFELongStep)MFEShort = (TakeProfitShort/MFEShortStep)If not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0EndifIf longonmarket thenMAXPRICE = MAX(MAXPRICE,close)If MAXPRICE-tradeprice(1)>=MFELong*pointsize thenpriceexit = MAXPRICE-MFELong*pointsizeEndifEndifIf shortonmarket thenMINPRICE = MIN(MINPRICE,close)If tradeprice(1)-MINPRICE>=MFEShort*pointsize thenpriceexit = MINPRICE+MFEShort*pointsizeEndifEndifIf onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPEndifEndif// Stop Loss aSET STOP LOSS SL// Target ProfitIf TargetProfit thenSET TARGET PROFIT TPEndif//graph BuyPrice//graph SellPrice//graph StopLossLong//graph StopLossShort11/14/2017 at 8:42 AM #5265911/14/2017 at 12:45 PM #52705 -
AuthorPosts
Find exclusive trading pro-tools on