M15 SP500 LowBuyHighSell Strategy
Forums › ProRealTime English forum › ProOrder support › M15 SP500 LowBuyHighSell Strategy
- This topic has 46 replies, 11 voices, and was last updated 9 months ago by nonetheless.
-
-
11/12/2023 at 8:32 PM #22362411/12/2023 at 8:40 PM #223625
Hi @fifi743
Your back test was done with a $250/point contract…
In my system there are two contracts with a value of 250 dollars/point, SPTRD (US 500 Cash) and SPTRD (US 500 Cash (250$))…
I don’t see any difference between these two contracts, only when I back test them I get the same result with the US 500 Cash as your back test, only when I use the other contract, I get the back test below… (Both 200k units)
11/12/2023 at 8:44 PM #22362711/12/2023 at 9:15 PM #22362911/12/2023 at 10:02 PM #22363512/04/2023 at 12:18 PM #224803hi phoentzs, I was just reading your code/script and was immediately excited about basic simplicity of the trading idea/concept. I “feel”/guess it is a valid, probably very competetive concept. (well, I would not say it has to do something with gap-trading). and you make it totally without common indicators-shmindincators – fascinating! 😀
few ideas/remarks, after looking in the details and “action” of the algo:
- by implementing mylowX and myhighX with variables “inside” (number of days you look back), you created kind of your own indicator with huge potential for optimization. why not to look just to previous day’s high & low as a trigger? simple, logical, no chance for optimization (and results are still very okay, I would say).
- something is “fishy” with mondays’ trades. one idea as a consequence is not to take any trades on mondays at all. but I think monday’s real issue in the algo is the open/close/high/low data which PRT/workstation provides you on “monday” on the “daily” timeframe, and correspondingly it influences all your own parameters which you link to this data, possibly to you disadvantage. please observe closely on the chart what your parameters (all which you are calling “my….” and “area” which is linked to “my…”) are doing on sunday/early monday.
regards
justinas
12/04/2023 at 12:19 PM #22480412/04/2023 at 2:15 PM #224818…sorry, maybe i expressed myself in misleading way: by „huge potential for optimization“ I mean that it is probably to your/trader‘s disadvantage! any variable which can be „optimized“ a lot decreases probably the robustness and so the chance that system makes money in various market conditions in the future. in your particular system I dont see any strong/logical/economical etc reason to make number of days you look back a „variable“. 1 day is supe fine, sigificant, simple, logical… another period could be 1 full working week. something in between or so might/will work as well but possibly is kind of „magic“, you might not want to rely on, even if it „produces“ more smooth equity curve or lower absolute drawdown or whatever more nice performance in the backtest/on paper.
12/04/2023 at 2:40 PM #224820@justisan
Thanks for your praise. Well, mylowx and myhighx also work great if you only use the previous day of both. I tried to get a certain long/short weighting into the system by optimizing both values. It is difficult to say whether the values are now over-optimized. In any case, many combinations work without the system breaking down. Which basically suggests that it is quite robust. The Monday problem… yes, the problem is that PRT also produces Sunday candles every now and then. So when we go to the store on Monday, we sometimes take the Sunday candle, which of course is nonsense. But unfortunately I haven’t figured out how to filter out this candle yet? Normally we should access the Friday candle on Mondays, which sometimes doesn’t work. As a result, we occasionally have poor performance on Mondays. Maybe someone has an idea how to basically filter out the Sunday candle?12/04/2023 at 4:00 PM #224831Hi Phoentzs, what do you think about the idea of separating Monday from the other days and let him take the value of the previous day (to check)?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990defParam cumulateOrders = falsedefParam preLoadBars = 10000defParam flatAfter = 220000cTime = time >= 080000 and time <= 210000positionSize = 4//-----------------------------------------------------------------------once maxOrdersL = 1 //max-Orders per Dayonce maxOrdersS = 1if intradayBarIndex = 0 then //reset orders countordersCountL = 0ordersCountS = 0endifif longTriggered then //check if an order has opened in the current barordersCountL = ordersCountL + 1endifif shortTriggered then //check if an order has opened in the current barordersCountS = ordersCountS + 1endif//------------------------------------------------------------timeframe(1 day, updateOnClose)//*********************************periodL = 3periodS = 13multiplierL = 0.4multiplierS = 1//*********************************monday = dayOfweek = 1dailyHighMonday = high[1]dailyCloseMonday = close[1]dailyLowMonday = low[1]dailyOpenMonday = open[1]areaDailyMonday = dailyHighMonday - dailyLowMondaydailyLowXMonday = lowest[periodL+1](low)dailyHighXMonday = highest[periodS+1](high)dailyHigh = highdailyClose = closedailyLow = lowdailyOpen = openareaDaily = dailyHigh - dailyLowdailyLowX = lowest[periodL](low)dailyHighX = highest[periodS](high)//--------------------------------------------------------------timeframe(15 minutes)//---------------------------------------------------------------cLongMonday = close < dailyLowXMondaycShortMonday = close crosses under dailyHighXMondaycLong = close < dailyLowXcShort = close crosses under dailyHighX//------------------------------------------------------------------if monday thenif cTime and cLongMonday and ordersCountL < maxOrdersL thenbuy positionSize contracts at marketset stop loss areaDailyMonday * multiplierLendifif longOnMarket and close > dailyCloseMonday and positionPerf*100 > 0.1 then // exit: gain > 0.1%sell at marketendifif cTime and cShortMonday and ordersCountS < maxOrdersS thensellshort positionSize contracts at marketset stop loss areaDailyMonday * multiplierSendifif shortOnMarket and close < dailyCloseMonday and positionPerf*100 > 0.3 then // exit: gain > 0.3%exitShort at marketendifendif//****************************************if not monday thenif cTime and cLong and ordersCountL < maxOrdersL thenbuy positionSize contracts at marketset stop loss areaDaily * multiplierLendifif longOnMarket and close > dailyClose and positionPerf*100 > 0.1 then // exit: gain > 0.1%sell at marketendifif cTime and cShort and ordersCountS < maxOrdersS thensellshort positionSize contracts at marketset stop loss areaDaily * multiplierSendifif shortOnMarket and close < dailyClose and positionPerf*100 > 0.3 then // exit: gain > 0.3%exitShort at marketendifendif//---------------------------------------------------------------------------------------graphOnPrice dailyLowX coloured("red")graphonprice dailyClose coloured("black")graphOnPrice dailyHighX coloured("green")12/04/2023 at 4:51 PM #22484112/04/2023 at 5:04 PM #22484312/04/2023 at 6:18 PM #22484812/04/2023 at 7:38 PM #224853This is the version 3 with only Monday optimized ( the impact is not so small: more than 10%).
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102//SP "lowBuy-highSell" v3 15m [spread 0.6] //TS by Phoentzs//https://www.prorealcode.com/topic/m15-sp500-lowbuyhighsell-strategy///*********************************************************************************defParam cumulateOrders = falsedefParam preLoadBars = 10000defParam flatAfter = 220000cTime = time >= 080000 and time <= 210000positionSize = 4//-----------------------------------------------------------------------once maxOrdersL = 1 //max-Orders per Dayonce maxOrdersS = 1if intradayBarIndex = 0 then //reset orders countordersCountL = 0ordersCountS = 0endifif longTriggered then //check if an order has opened in the current barordersCountL = ordersCountL + 1endifif shortTriggered then //check if an order has opened in the current barordersCountS = ordersCountS + 1endif//------------------------------------------------------------timeframe(1 day, updateOnClose)//*********************************periodL = 3periodS = 13multiplierLMonday = 0.3 // monday OPTmultiplierSMonday = 0.5 // monday OPTexitLMonday = 0.2 // monday OPTexitSMonday = 0.4 // monday OPTmultiplierL = 0.4multiplierS = 1exitL = 0.1exitS = 0.3//*********************************monday = dayOfweek = 1dailyHighMonday = high[1]dailyCloseMonday = close[1]dailyLowMonday = low[1]dailyOpenMonday = open[1]areaDailyMonday = dailyHighMonday - dailyLowMondaydailyLowXMonday = lowest[periodL+1](low)dailyHighXMonday = highest[periodS+1](high)dailyHigh = highdailyClose = closedailyLow = lowdailyOpen = openareaDaily = dailyHigh - dailyLowdailyLowX = lowest[periodL](low)dailyHighX = highest[periodS](high)//--------------------------------------------------------------timeframe(15 minutes)//---------------------------------------------------------------cLongMonday = close < dailyLowXMondaycShortMonday = close crosses under dailyHighXMondaycLong = close < dailyLowXcShort = close crosses under dailyHighX//------------------------------------------------------------------if monday thenif cTime and cLongMonday and ordersCountL < maxOrdersL thenbuy positionSize contracts at marketset stop loss areaDailyMonday * multiplierLMondayendifif longOnMarket and close > dailyCloseMonday and positionPerf*100 > exitLMonday thensell at marketendifif cTime and cShortMonday and ordersCountS < maxOrdersS thensellshort positionSize contracts at marketset stop loss areaDailyMonday * multiplierSMondayendifif shortOnMarket and close < dailyCloseMonday and positionPerf*100 > exitSMonday thenexitShort at marketendifendif//****************************************if not monday thenif cTime and cLong and ordersCountL < maxOrdersL thenbuy positionSize contracts at marketset stop loss areaDaily * multiplierLendifif longOnMarket and close > dailyClose and positionPerf*100 > exitL thensell at marketendifif cTime and cShort and ordersCountS < maxOrdersS thensellshort positionSize contracts at marketset stop loss areaDaily * multiplierSendifif shortOnMarket and close < dailyClose and positionPerf*100 > exitS thenexitShort at marketendifendif//---------------------------------------------------------------------------------------graphOnPrice dailyLowX coloured("red")graphonprice dailyClose coloured("black")graphOnPrice dailyHighX coloured("green")//---------------------------------------------------------------------------------------------12/04/2023 at 7:59 PM #224854Now it gets interesting. Thanks. I’ll run the versions in parallel in a demo to see if everything runs robustly. As mentioned at the beginning, this system would be ideal for a portfolio to hedge trend strategies. At least that’s my idea.
-
AuthorPosts
Find exclusive trading pro-tools on