Hey guys!
I´ve been hanging around in the shadows for a while tryin to learn from your coding knowledge.
I found this Indicator that i would love to make into an automatic trading system, seems like ot got it all.
HPT Heikin Ashi Smoothed
From what i understand I need to remove the return and color parts and add the buy and sell code.
Something like the inserted code but I have come to an end of my coding knowledge. Can someone help me?
//---settings
MaPeriod=6
MaPeriod2=2
//---end of settings
once maOpen=Open
once maClose=Close
once maLow=Low
once maHigh=High
if barindex>0 then
maOpen=(maOpen[1]*(MAperiod-1)+Open)/MAPeriod
maClose=(maClose[1]*(MAperiod-1)+Close)/MAPeriod
maLow=(maLow[1]*(MAperiod-1)+Low)/MAPeriod
maHigh=(maHigh[1]*(MAperiod-1)+High)/MAPeriod
haOpen=(ExtMapBuffer5[1]+ExtMapBuffer6[1])/2
haClose=(maOpen+maHigh+maLow+maClose)/4
haHigh=Max(maHigh, Max(haOpen, haClose))
haLow=Min(maLow, Min(haOpen, haClose))
if (haOpen<haClose) then
r=0
g=191
b=255
ExtMapBuffer7=haLow
ExtMapBuffer8=haHigh
else
r=255
g=10
b=0
ExtMapBuffer7=haHigh
ExtMapBuffer8=haLow
endif
ExtMapBuffer5=haOpen
ExtMapBuffer6=haClose
ExtMapBuffer1=weightedaverage[MAperiod2](ExtMapBuffer7)
ExtMapBuffer2=weightedaverage[MAperiod2](ExtMapBuffer8)
ExtMapBuffer3=weightedaverage[MAperiod2](ExtMapBuffer5)
ExtMapBuffer4=weightedaverage[MAperiod2](ExtMapBuffer6)
endif
if ExtMapBuffer7[1]<ExtMapBuffer8[1] and ExtMapBuffer7[2]>ExtMapBuffer8[2] and ExtMapBuffer7[0]<ExtMapBuffer8[0] then
buy 1 contract at market
endif
if ExtMapBuffer7[1]>ExtMapBuffer8[1] and ExtMapBuffer7[2]<ExtMapBuffer8[2] and ExtMapBuffer7[0]>ExtMapBuffer8[0] then
sell at market.
endif
I got it to spring into life so you can work it some more?
//---settings
MaPeriod=6
//MaPeriod2=2
//---end of settings
once maOpen=Open
once maClose=Close
once maLow=Low
once maHigh=High
if barindex>0 then
maOpen=(maOpen[1]*(MAperiod-1)+Open)/MAPeriod
maClose=(maClose[1]*(MAperiod-1)+Close)/MAPeriod
maLow=(maLow[1]*(MAperiod-1)+Low)/MAPeriod
maHigh=(maHigh[1]*(MAperiod-1)+High)/MAPeriod
haOpen=(ExtMapBuffer5[1]+ExtMapBuffer6[1])/2
haClose=(maOpen+maHigh+maLow+maClose)/4
haHigh=Max(maHigh, Max(haOpen, haClose))
haLow=Min(maLow, Min(haOpen, haClose))
if (haOpen<haClose) then
ExtMapBuffer7=haLow
ExtMapBuffer8=haHigh
else
ExtMapBuffer7=haHigh
ExtMapBuffer8=haLow
endif
ExtMapBuffer5=haOpen
ExtMapBuffer6=haClose
short = ExtMapBuffer7[1]>ExtMapBuffer8[1] and ExtMapBuffer7[2]<ExtMapBuffer8[2] and ExtMapBuffer7[0]>ExtMapBuffer8[0]
long = ExtMapBuffer7[1]<ExtMapBuffer8[1] and ExtMapBuffer7[2]>ExtMapBuffer8[2] and ExtMapBuffer7[0]<ExtMapBuffer8[0]
endif
If long Then
Buy 1 contract at market
Endif
if short then
sell at market
endif
//if short then
//sellshort 1 contract at market
//endif
//
//if long then
//exitshort at market
//endif
Nice GraHal! Thanks. I´ll come back if I get it to work decent