Dear all
I came up with the idea to create a short trading strategies that will use the asian high/low of the day as trigger for the rest of the forex trading day.
At the first glance the code looks good, but I don’t like the sharp decline you see in the end of the chart.
Any ideas how to improve the code is very welcome.
Thanks
Could you post the actual text of the code (using the ‘Insert PRT Code’ button) to save people from having to import the ITF file? You might get more help if it is easier for people to see the code.
defparam cumulateorders = false
once vHoch = 000000
once vTief = 999999
kStart = 000000
kEnde = 070000
if time > kStart and time < kEnde then
if high > vHoch then
vHoch = high
endif
if low < vTief then
vTief = low
endif
endif
if time > kEnde and time < 220000 then
if close crosses over vHoch then
buy 1 contracts at market
endif
if close crosses under vTief then
sellshort 1 contracts at market
endif
endif
if time = 220000 then
vHoch = 000000
vTief = 999999
endif
I am aware that the same functionality could be written smarter – but regarding readabiliy I kept this version.
Don’t worry about your coding style 😉 and thanks for sharing the idea.
So the strategy is allowed to loose multiple times the same day? I think that there might be something to do with orders quantity in a single day?
I did some analysis on the charts and also regarding fake moves. so it’s better – much better to add the final trigger mark 3 pips above high , lower low.
the revisted code looks now like this:
defparam cumulateorders = false
once vHoch = 000000
once vTief = 999999
kStart = 000000
kEnde = 080000
if time > kStart and time < kEnde then
if high > vHoch then
vHoch = high
endif
if low < vTief then
vTief = low
endif
endif
if time > kEnde and time < 220000 then
if close crosses over vHoch+0.003 then
buy 1 contracts at market
endif
if close crosses under vTief-0.003 then
sellshort 1 contracts at market
endif
set target pprofit 20
endif
if time = 220000 then
vHoch = 000000
vTief = 999999
endif
Nicolas good point. To be honest I haven’t thought about it. But as you see in v2 I added a TP of 20pips now.
Yes, maybe additional profit could be generated by placing a “smart” stop loss fx here as well.
Any suggestions folks?
Basically what you have coded is a break out strategy that only trades during the European and US sessions on breakouts of the Asian session high and low. This will always work better in trending markets than in sideways markets so adding a market sentiment filter of some sort might help. Also separating the strategy into two strategies – a long only and a short only might also be beneficial as when the Asian session ends with very close high and low then it is very likely that you will open a trade and quickly get stopped out in a reversal – and possibly many times! Having separate strategies allows you to play a little with different stop ideas other than relying on a breakout in the opposite direction for a stop which could be very close or very far away depending on Asian session volatility.
You could also make some data mining (stats) about how orders are performing depending of the High/Low range. Partial closure at predetermined level (e.g. 20 pips profit, next major round level, pivot points, ..) and let the rest run in profit could argue in favor of improvements?
You could also make some data mining (stats) about how orders are performing depending of the High/Low range. Partial closure at predetermined level (e.g. 20 pips profit, next major round level, pivot points, ..) and let the rest run in profit could argue in favor of improvements?
Are you suggesting simulating trades to match TP and SL to current market volatility? Sounds right up my street although so far I have found that it as badly lagging as a very lagging indicator from my tests so far.
Your second suggestion of partial closure would be interesting to test but PRT currently don’t allow us to run this live so it might be wasted effort if you want to run the idea automatically.
I’m afraid I can’t tell you which sentiment filter but it could be something as simple as a longer term moving average or anyone of the multitude of filters in the library. Maybe jebus89’s idea being discussed here might be a starting point for testing:
Higher timeframes bollinger filter
As far as I am aware it is possible to be both long in one strategy and short in another on an instrument. However I believe that if your account is a limited risk account then you can’t do this.