Since the trend of the moment is low timeframe systems, here is my proposal.
Based on the “Pivot Support / Resistance Zones” indicator by robertogozzi.
Position Size= 1
Spread= 0.7
EURUSD for now but maybe optimizable on different forex pairs
defparam cumulateorders= false
defparam flatbefore= 090000
defparam flatafter= 220000
once longtrading=1
once shorttrading=1
TIMEFRAME(15 minutes, updateonclose)
// Settings
ema1= exponentialaverage[20](close)
ema2= exponentialaverage[10](close)
bullish = close>ema1 and close>ema2 and ema1>ema2
ema1= exponentialaverage[20](close)
ema2= exponentialaverage[10](close)
bearish= close<ema1 and close<ema2 and ema1<ema2
TIMEFRAME(10 seconds)
// Indicator
myPivotSupportResistanceZones, myPivotSupportResistanceZones2 = CALL "Pivot Support/Resistance Zones"
if longtrading then
// Long
if close crosses over myPivotSupportResistanceZones then
if bullish then
buy 1 contract at market
endif
endif
endif
if shorttrading then
// Short
if close crosses under myPivotSupportResistanceZones2 then
if bearish then
sellshort 1 contract at market
endif
endif
endif
// Stop Loss
set stop ploss 15
// Trailing Stop
trailingstart= 50
trailingstep= 2
// Rest Stoploss
if not onmarket then
newsl= 0
endif
// Manage Long Positions
if longonmarket then
// First Move
if newsl= 0 and close-tradeprice(1)>=trailingstart*pipsize then
newsl= tradeprice(1)+trailingstep*pipsize
endif
// Next Moves
if newsl>0 and close-newsl>=trailingstep*pipsize then
newsl= newsl+trailingstep*pipsize
endif
endif
// Manage Short Positions
if shortonmarket then
// First Move
if newsl= 0 and tradeprice(1)-close>=trailingstart*pipsize then
newsl= tradeprice(1)-trailingstep*pipsize
endif
// Next Moves
if newsl>0 and newsl-close>=trailingstep*pipsize then
newsl= newsl-trailingstep*pipsize
endif
endif
// Stop Order To Exit The Positions
if newsl>0 then
sell at newsl stop
exitshort at newsl stop
endif
Sorry, there is an error with the code, from line 22 to 39 its
if longtrading then
// Long
if close crosses over myPivotSupportResistanceZones2 then
if bullish then
buy 1 contract at market
endif
endif
endif
if shorttrading then
// Short
if close crosses under myPivotSupportResistanceZones then
if bearish then
sellshort 1 contract at market
endif
endif
endif
Updated results
Good job.
Are you running it on your demo account?
Good job.
Are you running it on your demo account?
Just ultimated it today, i will run it from monday 🙂
Update v2
-minor optimization on the indicator
-system now works with both breakouts and bounces
defparam cumulateorders= false
defparam flatbefore= 090000
defparam flatafter= 220000
once longtrading=1
once shorttrading=1
TIMEFRAME(15 minutes, updateonclose)
// Settings
ema1= exponentialaverage[20](close)
ema2= exponentialaverage[10](close)
bullish = close>ema1 and close>ema2 and ema1>ema2
ema1= exponentialaverage[20](close)
ema2= exponentialaverage[10](close)
bearish= close<ema1 and close<ema2 and ema1<ema2
TIMEFRAME(10 seconds)
// Indicator
myPivotSupportResistanceZones, myPivotSupportResistanceZones2 = CALL "Pivot Support/Resistance Zones"
if longtrading then
// Long
if close crosses under myPivotSupportResistanceZones or close crosses over myPivotSupportResistanceZones2 then
if bullish then
buy 1 contract at market
endif
endif
endif
if shorttrading then
// Short
if close crosses under myPivotSupportResistanceZones or close crosses over myPivotSupportResistanceZones2 then
if bearish then
sellshort 1 contract at market
endif
endif
endif
// Stop Loss
set stop ploss 15
// Trailing Stop
trailingstart= 50
trailingstep= 2
// Rest Stoploss
if not onmarket then
newsl= 0
endif
// Manage Long Positions
if longonmarket then
// First Move
if newsl= 0 and close-tradeprice(1)>=trailingstart*pipsize then
newsl= tradeprice(1)+trailingstep*pipsize
endif
// Next Moves
if newsl>0 and close-newsl>=trailingstep*pipsize then
newsl= newsl+trailingstep*pipsize
endif
endif
// Manage Short Positions
if shortonmarket then
// First Move
if newsl= 0 and tradeprice(1)-close>=trailingstart*pipsize then
newsl= tradeprice(1)-trailingstep*pipsize
endif
// Next Moves
if newsl>0 and newsl-close>=trailingstep*pipsize then
newsl= newsl-trailingstep*pipsize
endif
endif
// Stop Order To Exit The Positions
if newsl>0 then
sell at newsl stop
exitshort at newsl stop
endif
Fun fact: works very good also on 1sec without changing nothing in the code. Synonymous of robustness and no overfitting?
Synonymous of robustness and no overfitting?
…or perhaps synonymous with getting something to work on a tiny part of history!
This is the main problem of working on systems with a low time frame,I have also repeatedly expressed my being doubtful about them.
Personally don’t know if I would ever start such a system on my live account
i wish you it works on 10S/1S… it’s so difficult this TF..
Franscesco, would you like to share the ITF so we get the right indicator bundled with the strategy?
So what do I need to do to get round the attached message?
I Think it’s because Francesco must have customized the indicator to return the two values, which is not in the original indicator, written to just plot segments, not returning data.
@Francesco please post your version of the indicator, ad TXT and/or ITF file.
@GraHal That happens because you didn’t add return values in the indicator.
Here’s the ITF with the complete and optimized indicator.
EDIT: robertogozzi preceded me with the explanation 🙂
Haha Thanks Francesco …. can’t wait for Monday now to try it out!! 🙂
Its good on DJI 5 sec and not a loser on DAX and USTech … if I recall correctly? I just flashed it over what was in my List.
Might it not be even better if the Indicator was not called but included within the strategy code and then below could be optimised ?
Or maybe I need to understand how it all hangs together, before making suggestions.
I’ll probably try this and that anyway over the weekend.
Keep up the Good Work!
PivotBAR = 3 //3 bars AFTER pivot
LookBack = 4 //4 bars BEFORE pivot
Yes GraHal, i guess it could be easily adapted for different assets, heres what we can optimize:
First of all PivotBAR and LookBack, but for eurusd 3 and 4 is already optimized. And yes! we can easily include the indicator in the strategy without the call in order to better optimize the values; v3 will have that for sure, already tried now!
Then the periods of the ema’s for the bullish and bearish detection (maybe ML on that?)
And of course sl and ts.