End Of Day – YEN M15 Strategy
Forums › ProRealTime English forum › ProOrder support › End Of Day – YEN M15 Strategy
- This topic has 95 replies, 8 voices, and was last updated 1 year ago by ZeroCafeine.
-
-
03/24/2023 at 10:38 AM #212048
Hi every one,
I start this topic to discuss this strategy and understand it and why not improve it and at the same time learn to program, here is the code of the strategy :
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253// END OF DAY - YEN// www.doctrading.frDefparam cumulateorders = false// TAILLE DES POSITIONSn = 1// PARAMETRES// high ratio = few positions// AUD/JPY : ratio = 0.5 / SL = 0.8 / TP = 1.2 / Period = 12// EUR/JPY : ratio = 0.6 / SL = 1 / TP = 0.8 / Period = 8// GBP/JPY : ratio = 0.5 / SL = 0.6 / TP = 1 / Period = 8// USD/JPY : ratio = 0.5 / SL = 1 / TP = 0.8 / Period = 12ratio = 0.5// HORAIRESstartTime = 210000endTime = 231500exitLongTime = 210000exitShortTime = 80000// STOP LOSS & TAKE PROFIT (%)SL = 1TP = 0.8Period = 12// BOUGIE REFERENCE à StartTimeif time = startTime THENamplitude = highest[Period](high) - lowest[Period](low)ouverture = closeendif// LONGS & SHORTS : every day except Fridays// entre StartTime et EndTimeif time >= startTime and time <= endTime and dayOfWeek <> 5 thenbuy n shares at ouverture - amplitude*ratio limitsellshort n shares at ouverture + amplitude*ratio limitendif// Stop Loss & Take Profitset stop %loss SLset target %profit TP// Exit Timeif time = exitLongTime thensell at marketendifif time = exitShortTime thenexitshort at marketendif03/24/2023 at 10:57 AM #212052This is a classic Asian session breakout strategy. You’ll find many literature on the web about.
1 user thanked author for this post.
03/24/2023 at 7:12 PM #212079tks you @Nicolas
if there are people willing to work with me on this strategy on understanding and why not improve it,
First of all I don’t know why my calculations are not good I don’t get the same entry price in Long :
Highest : 134.986
Lowest : 134.607
amplitude = Highest – Lowest = 134.986 – 134.607 = 0.379
Ouverture : 134.968in this situation, there is the price of Buy and SellShort :
1234if time >= startTime and time <= endTime and dayOfWeek <> 5 thenbuy n shares at ouverture - amplitude*ratio limit // 134.968 - 0.1895 = 134.778sellshort n shares at ouverture + amplitude*ratio limit // 134.986 + 0.01895 = 135.157endif1) question one, why the entry limit price it’s not the same of my math, maybe I did wrong ? it’s a limit price not market
2) according to the documentation it is not possible to be long and short at the same time, so normally the SellShort order should close the Long buy order
3) Also we can notice that we doubled our capital which makes us a gain of 100%, but also we had drawdown of more than 30%, Perhaps a better management with multiple timeframe or a good follow-up of the winning positions would have brought us a little more gain
4) If you have video or other links that summarize / explain this strategy for understanding I am a taker03/25/2023 at 11:23 AM #212092You are assuming LIMIT pending orders, while it could be that STOP pending are required. When placing pending orders, using the incorrect type may result in trades opened AT MARKET.
LIMIT pending orders are to be used when the entry price is most favourable than the entry price, i.e. you BUY at a lower price or SELLSHORT at a higher price, while STOP pending orders are to be used when you BUY at a higher price or SELLSHORT at a lower price (see attached pic).
1 user thanked author for this post.
03/26/2023 at 5:34 PM #212154ok, I understand you and your explaination is clear, but for me it’s still not clear why if they already have an limite long order it’s executed at a better price like a stop order, Also we speak about forex, so normaly no probleme of execution, but I don’t forget also I’m on a CFD with IG,
I will come back after some days about this execution problem, tks again robertogozzi
03/27/2023 at 5:05 AM #212170Let’s try to improve our code a little bit, some one can help me on line 50 to 54 ? I want to add an condition if our equity go down with X% (Drawdown) we have to stop the strategy :
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// USD/JPY preferred// H1Defparam CumulateOrders = False//Once Capital = 100000 // Initial Capital of 100 000 JPY//Once Equity = Capital// Lever (max recommended: 1.5)Leverage = 1// Choice of reinvesting earnings or notREINV = 0IF REINV = 0 THENn = 1 * LeverageENDIFIF REINV = 1 THENCapital = 100000 + StrategyProfitn = (Capital / 100000) * LeverageIF n <1 THENn = 1 // Minimum Size : 1ENDIFENDIF// Reference candle 18 to 22HIf Time = 220000 THENAmplitude = Highest[4](High) - Lowest[4](Low)Amplitude = Amplitude * 0.4Opening = CloseENDIF// BUY & SELL between 22H et 23H & We have to check GTM TimeIF time >= 220000 and time <= 230000 THENBuy n Shares AT Opening - Amplitude LimitSellshort n Shares AT Opening + Amplitude LimitENDIF// STOP & TARGETSET STOP %LOSS 0.4SET TARGET %PROFIT 1.2// EXITIF time = 100000 THENSELL AT MARKETEXITSHORT AT MARKETENDIF// STOP STRATEGIE IF DRAWDOWN OF 10%DrawDownwMax = 10IF Capital <= (Capital[1] - (Capital[1] / DrawDownwMax)) ThenQUITENDIF//IF STRATEGYPROFIT < -100 THEN//QUIT//ENDIF03/27/2023 at 5:33 AM #212171or this solution for max drawdown but sill not working :
12345678// STOP STRATEGIE IF DRAWDOWN OF 30%MaxDrawDownPercentage = 30Equity = 100000 + StrategyProfitMaxDrawdown = Equity * (MaxDrawDownPercentage/100)IF OnMarket and ((PositionPrice - low)*CountOfPosition) > MaxDrawDown THENQuitENDIF03/27/2023 at 6:28 AM #212174I found this solution for the maximum Drawdown, I save at every candle the highest equity I get in HighestEquity variable and compare with the current candle equity for quit if we got more then MaxDrawDownPercentage % :
123456789// STOP STRATEGIE IF DRAWDOWN OF 30%MaxDrawDownPercentage = 40Equity = 100000 + StrategyProfitHighestEquity = Max (HighestEquity,Equity) // Save the Maximum Equity we gotMaxDrawdown = HighestEquity * (MaxDrawDownPercentage/100)ExitFromMarket = Equity <= HighestEquity - MaxDrawdownIF ExitFromMarket ThenQuitENDIFBut this is woking good only after the position is closed, if some one can give me a help with the case if we are in the market for calculate the real PROFIT before closing a position in real time, because even we use a Stop Loss I think because we use only one time frame we can get some surprise, or maybe some good link for the equity management
03/27/2023 at 12:59 PM #212186@Moderator
I did a small mistake so maybe you can delete for me my message number: #212170 (or give me the possibility to edit it)03/27/2023 at 1:39 PM #212192Hi every one,
So as you can see I did a mistake in the message number #212170, So now there is agan the original code or the first strategie “End Of Day – YEN M15” we are talking about (Knowing that I don’t really believe in this strategy or understand it well, but it is necessary to start from a base to work and improve the code and therefore my programming on ProBuilder)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960// Strategy Name : END OF DAY - YEN// Version : 2.0// Information : I don't know what is this Strategie means ;-)// PARAMETRES // this is from the original code, I don't if it's working good// High Ratio = Few Positions// AUD/JPY : Ratio = 0.5 / SL = 0.8 / TP = 1.2 / Period = 12// EUR/JPY : Ratio = 0.6 / SL = 1 / TP = 0.8 / Period = 8// GBP/JPY : Ratio = 0.5 / SL = 0.6 / TP = 1 / Period = 8// USD/JPY : Ratio = 0.5 / SL = 1 / TP = 0.8 / Period = 12// ============================================================Defparam cumulateorders = false// Initial Capital of 100 000 JPY & Spread : 2Once Capital = 100000// SIZE OF THE POSITIONSN = 1Ratio = 0.5// TIMETABLEStartTime = 210000EndTime = 231500ExitLongTime = 210000ExitShortTime = 80000// STOP LOSS & TAKE PROFIT (%)SL = 1TP = 0.8Period = 12// CANDLE REFERENCE to StartTimeIF Time = StartTime THENAmplitude = Highest[Period](High) - Lowest[Period](Low)Opening = CloseENDIF// LONGS & SHORTS : every day except Fridays// between StartTime and EndTimeIF Time >= StartTime AND Time <= EndTime AND DayOfWeek <> 5 THENBuy N Shares AT (Opening - Amplitude * Ratio) LimitSellShort N Shares AT (Opening + Amplitude * Ratio) LimitENDIF// Stop Loss & Take ProfitSet Stop %Loss SLSet Target %Profit TP// Exit TimeIF Time = ExitLongTime THENSell AT MarketENDIFIF Time = ExitShortTime THENExitShort AT MarketENDIFand there is the result with :
USD/JPY Mini
Initial Capital : 100000 JPY
Test on a candle history of : 50K
Spread : 2Here are the results of the original strategy without any modifications (see photo)
03/27/2023 at 1:44 PM #212196Someone can tell me why there is a difference between the result of equity of : 202 880 JPY and 193 670 JPY, maybe the spread fees is calculated only in the detailed report ?
03/27/2023 at 2:27 PM #212201lets start with some backtest with a max DrowDawn of 5%, the result is -5,64% from the equity, you can see the screen short
03/27/2023 at 2:29 PM #212204with a max DrowDawn of 10%, the result is -10,51% from the equity, you can see the screen short
03/27/2023 at 2:30 PM #212206with a max DrowDawn of 20%, the result is -20,77% from the equity, you can see the screen short
03/27/2023 at 2:32 PM #212209with a max DrowDawn of 40%, the result is +100% from the equity, you can see the screen short
-
AuthorPosts
Find exclusive trading pro-tools on