I love the following indicator, created by Gidien: https://www.prorealcode.com/prorealtime-indicators/heikin-ashi-advanced/
I’m interested in incorporating this indicator into my trading strategy, but I’m not well-versed in coding.
As a beginner, I’d appreciate assistance with the following:
- Buy when the candlestick is green.
- Sell when the candlestick is red.
This would already mean a step forward for me.
I hope someone can assist me with this
Gr
Good morning
For example
purchase:
F= ao < ac and ao[1]>ac[1]
if F then
BUY 10000 CASH at market
SET STOP %LOSS ts
SET target %profit tp
endif
sale :
G= ao > ac and ao[1]<ac[1]
if G then
SELL 10000 CASH at market
SET STOP %LOSS ts
SET target %profit tp
endif
JSParticipant
Senior
Hi,
Here is the system that buys when the color changes to green and sells when the color changes to red…
// ############# Heikin-Ashi Advanced ##################################################
// Written by GSL
DefParam CumulateOrders=False
bo = Average[MAX(1,sma1),AverageType1](Open)
bh = Average[MAX(1,sma1),AverageType1](high)
bl = Average[MAX(1,sma1),AverageType1](low)
bc = Average[MAX(1,sma1),AverageType1](close)
IF BarIndex <= sma1 + 1 THEN
haOpen = bo
haClose = bc
haHigh = bh
haLow = bl
//PRINT(haClose)
ELSe
haOpen = (haOpen[1] + haClose[1]) / 2
haClose = (bo + bc + bl + bh ) / 4
haHigh = MAX( MAX(bh , haOpen), haClose )
haLow = MIN( MIN(bl , haOpen), haClose )
ao = Average[MAX(1,sma2),AverageType2](haOpen)
ah = Average[MAX(1,sma2),AverageType2](haHigh)
al = Average[MAX(1,sma2),AverageType2](haLow)
ac = Average[MAX(1,sma2),AverageType2](haClose )
ENDIF
IF ao < ac THEN
Buy 1 contract at Market
ELSIF ao > ac THEN
SellShort 1 contract at Market
EndIf
Thx for the *.itf , JS.
In your screenshot, it indeed seem to do the trick, exactly how I would want it. But in my workstation, it appears different.
Also the name of the backtest appears as (0 0 48 26) and not as (0 0 f 7 3)
Maybe this is because I’m using it on timeframes of 1 week? Any tips?
JSParticipant
Senior
Hi,
Did you use the “ITF” file because it contains the parameters that you can adjust…
The time frame shouldn’t matter when using the system, but it does affect the results…
Got it fixed
Thx for the help all !