hi guys, someone can help me to resolves this problem with heiken Ashi ?
i want just go long when is green e go short when is red.
i tried a lot of codes that i took on Prorealcode forum but i have the same problem .
look at the pic
Thanks in advance
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
xClose = (open+high+low+close)/4
IF BarIndex=0 THEN
xOpen = open
ELSE
xOpen = (xOpen[1] + xClose[1])/2
endif
IF XClose >XOpen THEN
BUY 1 CONTRACT AT MARKET
else
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
cftaParticipant
Senior
Ciao Enzo,
I have a code for this in my Grid Step thread, you can easily change it if you want to remove some parameters such as the grid step function or the DI and ADX filters;
Grid orders with one combined stop loss and limit, can it be done?
A system based on Heiken Ashi can be very profitable but we need some sort of filters to avoid trading during sideways movements, the filters in my code helps but we can probably find more useful indicators for that.
hi cfta, thanks for your answer but does not work for me…can you have a look please?
DEFPARAM CumulateOrders = false
//Heikin-Ashi
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
changeToGreencandle = xClose>xOpen AND xClose[1]<xOpen[1]
ChangeToRedcandle = xClose<xOpen AND xClose[1]>xOpen[1]
if changeToGreencandle then
buy 1 contract at market
endif
if ChangeToRedcandle then
sellshort 1 contract at market
endif
this is the TS that i tried too..but does not work…
this is the indicator:
//Heikin-Ashi
xClose = (Open+High+Low+Close)/4
if(barindex>2) then
xOpen = (xOpen[1] + xClose[1])/2
endif
changeToGreencandle = xClose>xOpen AND xClose[1]<xOpen[1]
ChangeToRedcandle = xClose<xOpen AND xClose[1]>xOpen[1]
Greencandle=xclose>xopen
redcandle=xclose<xopen
If changeToGreencandle then
Indicator1=1
elsif greencandle then
indicator1=0.5
elsif Changetoredcandle then
indicator1=-1
elsif redcandle then
indicator1=-0.5
Else
Indicator1=0
Endif
Return indicator1
this is the TS
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
// Condizioni per entrare su posizioni long
indicator1 = CALL "Heikin ashi"
c1 = (indicator1[1] = 0.5)
indicator2 = CALL "Heikin ashi"
c2 = (indicator2[1] = 1)
IF not onmarket and c1 OR c2 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Condizioni per entrare su posizioni short
indicator3 = CALL "Heikin ashi"
c3 = (indicator3[1] = -1)
indicator4 = CALL "Heikin ashi"
c4 = (indicator4[1] = -0.5)
IF not onmarket and c3 OR c4 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF