Today, I would like to share with you a strategy developed for the US 500 index
This one relies on Ichimoku to validate the trend and give the signals to enter
Its objective is to follow the evolution of the price rise or fall in order to benefit from it.
It also aims to exit the position at the most favorable time to cash out regularly.
However, the objective remains a long-term one for annual performance.
The success of the backtest is based on the optimisation of the stop loss and the clear upward trend in the price.
Also, money management is in place to ensure that a crack addict does not destroy the entire portfolio.
//
//============================== Basic setting
defparam cumulateorders = false
//============================== Money Management
Capital = 10000
Lotss = Capital / 1000 // Value of risk on capital (attention)
//============================== setting Management
if Lotss < 1 then
Lotss = 1
endif
set stop loss (Capital*45)/100
set stop %loss 9
//============================== Indicator
SpanA = (Tenkan[26]+Kijun[26])/2
Tenkan = (highest[9](high)+lowest[9](low))/2
Kijun = (highest[26](high)+lowest[26](low))/2
SpanB = (highest[52](high[26])+lowest[52](low[26]))/2
timeframe(1hours)
XSpanA = (XTenkan[26]+XKijun[26])/2
XTenkan = (highest[9](high)+lowest[9](low))/2
XKijun = (highest[26](high)+lowest[26](low))/2
XSpanB = (highest[52](high[26])+lowest[52](low[26]))/2
timeframe(default)
timeframe(4hours)
XXSpanA = (XXTenkan[26]+XXKijun[26])/2
XXTenkan = (highest[9](high)+lowest[9](low))/2
XXKijun = (highest[26](high)+lowest[26](low))/2
XXSpanB = (highest[52](high[26])+lowest[52](low[26]))/2
timeframe(default)
//============================== setting trend Bullish
T1 = close > Kijun
T2 = close > SpanA and close > SpanB
TrendBullish1 = T1 and T2
timeframe(1hours)
T3 = close > XKijun
T4 = close > XSpanA and close > XSpanB
TrendBullish2 = T4 and T3
timeframe(default)
timeframe(4hours)
T5 = close > XXKijun
T6 = close > XXSpanA and close > XXSpanB
TrendBullish3 = T5 and T6
timeframe(default)
TrendBullish = TrendBullish1 and TrendBullish2 and TrendBullish3
//============================== setting Signal
S1 = low =< Kijun
S2 = low =< SpanA
S3 = low =< SpanB
S = S1 or S2 or S3
Signal = TrendBullish and S
//============================== setting Buy
if Signal then
buy lotss contract at market
endif
if close < kijun and close > positionprice then
sell at market
endif
Thanks for the strategy, however I think like for this other strategy: Long US Tech 100 Ichimoku strategy that there might be something wrong in the stoploss calculation at line 18?
Thanks for sharing.
I have some doubt about the interest of it because the index curve and the equity curve are very similar, and it is a long only strategy on a bull market index… so why not just buy and hold ?
And the algo often exits a position and enters a new position a few time after, so the exit orders are useless most of the time.
Hello Nicolas, indeed, it is not conventional…
However, it is a method I use to use a %Stop
In limited risk CFD account, this kind of stop are not accessible, surprisingly, if I place a normal stop then a %stop it works…
It’s adapting to the limited risk account.
This message will also be on this post like that x)
Hello Roger,
Indeed, this is correct.
That was also the goal of this strategy, closed to cash in regularly.
In this way, a reinvestment of the profits can be envisaged.
Otherwise indeed, the performances are almost identical without closing.
However, the code can be modified and improved and shared again, it remains a “basic” idea.
This type of strategy remains simple and profitable over the long term with high potential markets.
And the algo often exits a position and enters a new position a few time after, so the exit orders are useless most of the time.
Useless with hindsight, but if price had gone against the exited position then not useless?
I don’t mind a strategy that exits often as long as the exit is at a logical place that warrants an exit … price is showing signs of reversing.
Actually the exit condition is :
if close < kijun and close > positionprice then
sell at market
endif
So you are right, it may be a “good reason” to exit. My bad !
What i said could be relevant if there was a target price, and in this case a trailing stop could avoid paying the broker spread so many times.
The problem with setting a shorter stop on this value is that the backtest would not be efficient.
But it is fresh that closing so many times necessarily increases the costs…