I have two Data streams, the second stream is with Haikin Ashi candles and with a SuperTrend indicator (variable "st") while the first Data stream is with regular bars and without any indicator. I would like to trigger the signal buy or sell starting from the stream Data2: when the close of Heikin Ashi is above or below Supertrend, it triggers a buy or sell for the stream Data1 but it is stubborn and looks like that it is not able to recognize the Heikin Ashi values.
Code: Select all
if marketposition = 0 and Close of Data2 > st of data2 then buy ("L") 1 contracts next bar at market;
if marketposition = 1 and Close of Data2 < st of data2 then sell ("STP_L") 1 contracts next bar at market;
if marketposition = 0 and Close of Data2 < st of data2 then sellshort ("S") 1 contracts next bar at market;
if marketposition =-1 and Close of Data2 > st of data2 then buytocover ("STP_S") 1 contracts next bar at market;