I use the Heikin Ashi Smooth as a moving average and want to incorporate it into a system.
I want to code buy and sell signals based on the Heikin Ashi smooth.
Buy when first green Heikin Ashi smooth appears and closes, after a succession of red Heikin Ashi smooth.
This to be irrespective of where price action candles are on the chart.
I will concentrate on the buy side and then move onto developing the sell side.
Attached is a screen shot of the red Heikin Ashi eventually closing green……..the setting price in the back ground is Line + points.
Any guidance on this first element would be very helpful.
Many thanks
……………I think I have found the code……
Ok I had a crack at the code using the simplified method of creating code……….
Its telling me there is a syntax error in line 6 (as that has an exclamation mark in an orange triangle – LOL)
Just trying to get it started in the first instance i.e. buy when Heikin Ashi Smooth candle turns green after a red candle………..although I only could think that you would have to state that the Heikin Ashi smooth indicator relevant
candle would close above the open as I dont think you can program colour changes? is that correct?
Any guidance would be a great help.
Thanks.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
c1 = CALL "Heikin_Candle_smoothed"[21, 5, -2, 21, 0]
> CALL "Heikin_Candle_smoothed"[21, 5, -2, 21, 0]
[1]
IF c1 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
c2 = (CALL "Heikin_Candle_smoothed"[21, 5, -2, 21, 0]
< CALL "Heikin_Candle_smoothed"[21, 5, -2, 21, 0]
[1])
IF c2 THEN
SELL 1 PERPOINT AT MARKET
ENDIF
Lines 6 and 15 have more than one error each:
- remove the initial “>”
- use a variable to assign the returned value of the CALL.
Hi.
Thanks for getting back.
I dont understand ‘use a variable to assign the returned value of the CALL.’
thanks
Because CALL returns a value and that value has to be stored somewhere, like in lines 5 and 14, so that you can compare them.
You cannot use “>” to compare 2 different CALL and it cannot be written in separate lines.