TRADE LIKE CASINO inspired by by Adam Khoo
Forums › ProRealTime English forum › ProOrder support › TRADE LIKE CASINO inspired by by Adam Khoo
- This topic has 11 replies, 6 voices, and was last updated 6 years ago by Vonasi.
-
-
11/17/2017 at 8:40 AM #53076
Hi all,
Inspired by the videos and methodology from Adam Khoo (https://www.youtube.com/watch?v=bRCtBRsLPmk ) , I create this strategy using my indicator Leo Moving Average for detect local maximums and minimums.
Although my code is universal (for any market and any frame trade) Here is what I got, the strategy reflects my trading style: few money per trade to risk, small time frame, mini contract in IG.
The strategy is simple: buy in support sell in resistance…. but:
- When the ratio price-stoploss and price stopprofit is higher than “Kcasino” which is a number more than one
- When the trend is in favor (higher lows or lowers highs)
- When the long term bias is in our favor
I still not confident with the strategy because I like strategies with more winning ratios for using in real life.
I hope we can all improve it.
Cheers
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182//TRADE LIKE CASINO//THIS IS A TRADING STRATEGY IN AREAS WHERE THE PROFIT/RISK RATIO IS HIGH THAN A VALUE (Kcasino) WHERE PROPABILITY IS IN THE FAVOR OF THE MOVEMENT//inspired by Adam Khoo//Autor: LEODEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM PreLoadBars = 3000 //cargar informacion//VARIABLES TO BE OPTIMIZED//period=20 //Period for analysis//Kcasino=1.75 //minimum profit/risk ratio between support and resistance//LongPeriod=1440 //Long term period for check bias//maxrisk=13 //max risk in pips for tradespread=0.7IF TIME < 060000 THEN //(germany time)spread=2*spreadELSIF TIME>213000 THEN //(germany time)spread=2*spreadENDIFtotalrisk=4*maxrisk*n*PIPVALUE //for stop the robot if things are going bad//Robot Working Time (Germany)IF TIME>023000 and TIME < 210000 THENontime=1ELSEontime=0ENDIF////// RISK CONTROL IF THINGS ARE GOING WONDERFULL //////n = 1 + (strategyprofit / (134*pipvalue))n = round(n * 100)n = n / 100n = max(1,n)//-----------//Leo Moving Average, formula: LMA= WMA+(WMA-SMA)LMA=2*weightedaverage[period](close)-average[period](close)//Smoothed curve of Leo Moving AverageIF BARINDEX > period THENsmoothLMA=weightedaverage[period](LMA)ELSEsmoothLMA=undefinedENDIF// Direction or trend of the LMA// << Storage of minimums and maximums >>once mintemp=lowonce posmintemp=1once maxtemp=highonce posmaxtemp=1IF BARINDEX>2 THEN// the value 0.7 is to ensure that the donchian channel is faster than the curves analysis (this value to be checked)IF low < lowest[round(0.7*period)](low[1]) THENmintemp=low //minimum temporalposmintemp=BARINDEX //postition of minimum temporalENDIFIF high > highest[round(0.7*period)](high[1]) thenmaxtemp=high //maximum temporalposmaxtemp=BARINDEX //position maximum temporalENDIFENDIF// << Detecting and locating a local minimums >>// Where the LMA is crossing the smoothed LMA, there is a maximum or minimum nearby// If there is a new local min/max, the preivus one is stored in de varible B... (before)once LEVMIN=lowonce POSLEVMIN=1once LEVMAX=highonce POSLEVMAX=1once bullcross=0once bearcross=0IF BARINDEX > PERIOD THEN //For avoid computer errorsbullcross=LMA crosses over smoothLMAbearcross=LMA crosses under smoothLMAENDIFIF bullcross and POSLEVMIN<>posmintemp THENBBLEVMIN=BLEVMIN // previus previus local minimum is saved//BBPOSLEVMIN=BPOSLEVMINBLEVMIN=LEVMIN //previus local minimum is saved//BPOSLEVMIN=POSLEVMINLEVMIN=mintempPOSLEVMIN=posmintempsupport=LEVMINENDIF// --> Detecting and locating a local maximumIF bearcross and POSLEVMAX<>posmaxtemp THENBBLEVMAX=BLEVMAX //previus local maximum is saved//BBPOSLEVMAX=BPOSLEVMAXBLEVMAX=LEVMAX //previus local maximum is saved//BPOSLEVMAX=POSLEVMAXLEVMAX=maxtempPOSLEVMAX=posmaxtempresistance=LEVMAXENDIFonce support=lowonce resistance=highsupport=min(low,support)resistance=max(high,resistance)//------------period2=LongPeriod//Leo Moving Average, formula: LMA= WMA+(WMA-SMA)LMA2=2*weightedaverage[period2](close)-average[period2](close)//Smoothed curve of Leo Moving AverageIF BARINDEX > period2 THENsmoothLMA2=weightedaverage[period2](LMA)ELSEsmoothLMA2=undefinedENDIF//LONG TRADESIF BBLEVMIN<BLEVMIN and BLEVMIN<LEVMIN and support=LEVMIN and close>smoothLMA THEN//higher lows, support has not been broken before and price is going upStopLossLong = (close-support)/pipsize + 2*spread //distance in pips for stoplossStopProfitLong = ((resistance+(resistance-support)*0.27)-close)/pipsize-2*spread //distance in pips to stopprofit (where an hippotetical support is brake until the fibbo expansion)IF StopProfitLong/StopLossLong > Kcasino THEN//the ratio between support and hipotetical brake of the next resistance is higher than KcasinoIF LMA2 > smoothLMA2 THEN //we have long term bias//HERE WE TRADEIF NOT LongOnMarket AND ontime=1 and StopLossLong<maxrisk THENBUY n CONTRACTS AT MARKETSET STOP pLOSS StopLossLongSET TARGET pPROFIT StopLossLong*KcasinoENDIFENDIFENDIFENDIF//SHORT TRADESIF BBLEVMAX>BLEVMAX and BLEVMAX>LEVMAX and resistance=LEVMAX and close<smoothLMA THEN//lower highs, resistance have not been broken before and price going downStopLossShort=(resistance-close)/pipsize+2*spreadStopProfitShort=(close-(support-(resistance-support)*0.27))/pipsize-2*spreadIF StopProfitShort/StopLossShort > Kcasino THEN//the ratio between resistance and hipotetical brake of the next support is higher than KcasinoIF LMA2 < smoothLMA2 THEN //we have long term bias//HERE WE TRADEIF NOT ShortOnMarket AND ontime=1 and StopLossShort<maxrisk THENSELLSHORT n CONTRACTS AT MARKETSET STOP pLOSS StopLossShortSET TARGET pPROFIT StopLossShort*KcasinoENDIFENDIFENDIFENDIFIF longonmarket thenIF TIME > 224500 and DayOfWeek=5 thenSELL AT MARKETENDIFendifIF shortonmarket thenIF TIME > 224500 and DayOfWeek=5 thenEXITSHORT AT MARKETENDIFendif//Quit the robot if things are going badQ=MAX(Q,(STRATEGYPROFIT/pipvalue))R=Q-STRATEGYPROFIT/pipvalueIF R > totalrisk THENQUITENDIFIF STRATEGYPROFIT < (-1*totalrisk) THENQUITENDIF1 user thanked author for this post.
11/17/2017 at 8:45 AM #53085Hi Leo, thank you very much for your post proposal in the library. I did not make a lot of tests about it but since it is mainly based upon optimized variables, and in order to maintain some kind of “quality” (to prevent discussions about overfitting, etc..), I’d prefer to publish it if you could make some robustness tests with the Walk Forward tool. If not that’s ok too, we can discuss about the strategy in this topic 🙂 Thank you again for your kindness.
11/17/2017 at 11:59 AM #53102Is it possible to create a screener for swing trading with this ?
11/18/2017 at 9:03 PM #5320211/19/2017 at 9:45 AM #53221Hi Leo, thanks for the WFA. The OOS WFE are not so great but not too bad too! So in this case I would advise to try more OOS periods to reduce the time the optimized variables are used for the strategy (1 month in 1 minute timeframe is a lot of bars). Good luck and have a nice Sunday 😉
11/20/2017 at 1:30 PM #5329911/25/2017 at 8:42 AM #53899Hi all,
I got this code:
- The code calculates and stores local max and min with a LMA indicator using “period”
- The code also looking for local max and min with a faster LMA using “period3”
- Entry long conditions are (for short are opposite)
- When there are higher lows and higher highs and the price is situated in a zone where stop and resistance has a ratio of Casino(>1)
- It is according to a long period moving average
I hope you like the code, I am very optimistic because is like trading manual but with a computer…. but somehow I am not fully satisfied. I think there should be another type of indicator for filtering/confirm the entry.
Can you tell me your opinions ?
TRADE LIKE CASINO v1.2123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254//TRADE LIKE CASINO v1.2//THIS IS A TRADING STRATEGY IN AREAS WHERE THE PROFIT/RISK RATIO IS HIGH THAN A VALUE (Kcasino) WHERE PROPABILITY IS IN THE FAVOR OF THE MOVEMENT//inspired by Adam Khoo//Autor: LEODEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM PreLoadBars = 3000 //cargar informacion//VARIABLES TO BE OPTIMIZED//period=20 //Period for analysis//Kcasino=1.75 //minimum profit/risk ratio between support and resistance//LongPeriod=1440 //Long term period for check bias//maxrisk=13 //max risk in pips for trade//Kperiod=0.5 //spread=0.7IF TIME < 060000 THEN //(germany time)spread=2*spreadELSIF TIME>213000 THEN //(germany time)spread=2*spreadENDIFtotalrisk=4*maxrisk*n*PIPVALUE //for stop the robot if things are going bad//Robot Working Time (Germany)IF TIME>023000 and TIME < 210000 THENontime=1ELSEontime=0ENDIF////// RISK CONTROL IF THINGS ARE GOING WONDERFULL //////n = 1 + (strategyprofit / (134*pipvalue))n = round(n * 100)n = n / 100n = max(1,n)//-----------//Leo Moving Average, formula: LMA= WMA+(WMA-SMA)LMA=2*weightedaverage[period](close)-average[period](close)//Smoothed curve of Leo Moving AverageIF BARINDEX > period THENsmoothLMA=weightedaverage[period](LMA)ELSEsmoothLMA=undefinedENDIF// Direction or trend of the LMA// << Storage of minimums and maximums >>once mintemp=lowonce posmintemp=1once maxtemp=highonce posmaxtemp=1IF BARINDEX>2 THEN// the value 0.7 is to ensure that the donchian channel is faster than the curves analysis (this value to be checked)IF low < lowest[round(0.7*period)](low[1]) THENmintemp=low //minimum temporalposmintemp=BARINDEX //postition of minimum temporalENDIFIF high > highest[round(0.7*period)](high[1]) thenmaxtemp=high //maximum temporalposmaxtemp=BARINDEX //position maximum temporalENDIFENDIF// << Detecting and locating a local minimums >>// Where the LMA is crossing the smoothed LMA, there is a maximum or minimum nearby// If there is a new local min/max, the preivus one is stored in de varible B... (before)once LEVMIN=lowonce POSLEVMIN=1once LEVMAX=highonce POSLEVMAX=1once bullcross=0once bearcross=0IF BARINDEX > PERIOD THEN //For avoid computer errorsbullcross=LMA crosses over smoothLMAbearcross=LMA crosses under smoothLMAENDIFIF bullcross and POSLEVMIN<>posmintemp THEN//BBLEVMIN=BLEVMIN // previus previus local minimum is saved//BBPOSLEVMIN=BPOSLEVMINBLEVMIN=LEVMIN //previus local minimum is saved//BPOSLEVMIN=POSLEVMINLEVMIN=mintempPOSLEVMIN=posmintempsupport=LEVMINENDIF// --> Detecting and locating a local maximumIF bearcross and POSLEVMAX<>posmaxtemp THEN//BBLEVMAX=BLEVMAX //previus local maximum is saved//BBPOSLEVMAX=BPOSLEVMAXBLEVMAX=LEVMAX //previus local maximum is saved//BPOSLEVMAX=POSLEVMAXLEVMAX=maxtempPOSLEVMAX=posmaxtempresistance=LEVMAXENDIFonce support=lowonce resistance=highsupport=min(low,support)resistance=max(high,resistance)/////////////////////////////////////////////////////------------------------------------------------period3=round(Kperiod*period)//Leo Moving Average, formula: LMA= WMA+(WMA-SMA)LMA3=2*weightedaverage[period3](close)-average[period3](close)//Smoothed curve of Leo Moving AverageIF BARINDEX > period3 THENsmoothLMA3=weightedaverage[period3](LMA3)ELSEsmoothLMA3=undefinedENDIF// Direction or trend of the LMA// << Storage of minimums and maximums >>once mintemp3=lowonce posmintemp3=1once maxtemp3=highonce posmaxtemp3=1IF BARINDEX>2 THEN// the value 0.7 is to ensure that the donchian channel is faster than the curves analysis (this value to be checked)IF low < lowest[round(0.7*period3)](low[1]) THENmintemp3=low //minimum temporalposmintemp3=BARINDEX //postition of minimum temporalENDIFIF high > highest[round(0.7*period3)](high[1]) thenmaxtemp3=high //maximum temporalposmaxtemp3=BARINDEX //position maximum temporalENDIFENDIF// << Detecting and locating a local minimums >>// Where the LMA is crossing the smoothed LMA, there is a maximum or minimum nearby// If there is a new local min/max, the preivus one is stored in de varible B... (before)once LEVMIN3=low//once POSLEVMIN3=1once LEVMAX3=high//once POSLEVMAX3=1once bullcross3=0once bearcross3=0IF BARINDEX > PERIOD3 THEN //For avoid computer errorsbullcross3=LMA3 crosses over smoothLMA3bearcross3=LMA3 crosses under smoothLMA3ENDIFIF bullcross3 and POSLEVMIN3<>posmintemp3 THEN//BLEVMIN3=LEVMIN3 //previus local minimum is saved//BPOSLEVMIN3=POSLEVMIN3LEVMIN3=mintemp3POSLEVMIN3=posmintemp3support3=LEVMIN3ENDIF// --> Detecting and locating a local maximumIF bearcross3 and POSLEVMAX3<>posmaxtemp3 THEN//BLEVMAX3=LEVMAX3 //previus local maximum is saved//BPOSLEVMAX3=POSLEVMAX3LEVMAX3=maxtemp3POSLEVMAX3=posmaxtemp3resistance3=LEVMAX3ENDIFsupport3=min(low,support3)resistance3=max(high,resistance3)////////////////// LONG TERM BIAS ///////////////------------period2=LongPeriod//Leo Moving Average, formula: LMA= WMA+(WMA-SMA)LMA2=2*weightedaverage[period2](close)-average[period2](close)//Smoothed curve of Leo Moving AverageIF BARINDEX > period2 THENsmoothLMA2=weightedaverage[period2](LMA)ELSEsmoothLMA2=undefinedENDIF//LONG TRADESIF BLEVMIN<LEVMIN and LEVMIN<LEVMIN3 and support=LEVMIN and close>smoothLMA3 and BLEVMAX<LEVMAX THEN//higher lows, support has not been broken before and price is going upStopLossLong = (close-support3)/pipsize + 2*spread //distance in pips for stoplossStopProfitLong = (resistance-close)/pipsize-4*spread //distance in pips to stopprofit (where an hippotetical support is brake until the fibbo expansion)IF StopProfitLong/StopLossLong > Kcasino THEN//the ratio between support and hipotetical brake of the next resistance is higher than KcasinoIF LMA2 > smoothLMA2 THEN //we have long term bias//HERE WE TRADEIF NOT LongOnMarket AND ontime=1 and StopLossLong<maxrisk THENBUY n CONTRACTS AT MARKETSET STOP pLOSS StopLossLongSET TARGET pPROFIT StopLossLong*(Kcasino-0.25)ENDIFENDIFENDIFENDIF//SHORT TRADESIF BLEVMAX>LEVMAX and LEVMAX>LEVMAX3 and resistance=LEVMAX and close<smoothLMA3 and BLEVMIN > LEVMIN THEN//lower highs, resistance have not been broken before and price going downStopLossShort=(resistance3-close)/pipsize+2*spreadStopProfitShort=(close-support)/pipsize-4*spreadIF StopProfitShort/StopLossShort > Kcasino THEN//the ratio between resistance and hipotetical brake of the next support is higher than KcasinoIF LMA2 < smoothLMA2 THEN //we have long term bias//HERE WE TRADEIF NOT ShortOnMarket AND ontime=1 and StopLossShort<maxrisk THENSELLSHORT n CONTRACTS AT MARKETSET STOP pLOSS StopLossShortSET TARGET pPROFIT StopLossShort*(Kcasino-0.25)ENDIFENDIFENDIFENDIFIF longonmarket thenIF TIME > 224500 and DayOfWeek=5 thenSELL AT MARKETENDIFendifIF shortonmarket thenIF TIME > 224500 and DayOfWeek=5 thenEXITSHORT AT MARKETENDIFendif//Quit the robot if things are going badQ=MAX(Q,(STRATEGYPROFIT/pipvalue))R=Q-STRATEGYPROFIT/pipvalueIF R > totalrisk THENQUITENDIFIF STRATEGYPROFIT < (-1*totalrisk) THENQUITENDIF1 user thanked author for this post.
11/26/2017 at 2:43 PM #5400911/26/2017 at 7:24 PM #5403211/28/2017 at 2:27 PM #5427306/07/2018 at 2:48 PM #72574HI
Thank you for sharing your idea.
When I want to compile it, I have errors in these too lines
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
and
the last
ENDIF
would you please help me to solve it? I am working with MQL5 editor.
looking forward to you
Thank you
06/07/2018 at 9:54 PM #72600 -
AuthorPosts
Find exclusive trading pro-tools on