Reversing position off MACD
Posted: 24 Oct 2013 14:11
I am trying to automate trading from a MACD. I have been able to automate the MACD to go 'long' with 'AutoOrder' when crossing above 0, but the 'AutoOrder' closes the position once crossing below the 0. I want it to rather reverse the position when crossing below the 0.
I am using the MACD_NEO in the 'Express' to do this, is there a way to modify this to reverse position instead of close? Or is there any other way to do this?
EXPRESS MACD_NEO
VARS
series myMACD(MACD.main), flag ;
CALCULATION
if (myMACD[1]>= 0) then flag = 1;
if (myMACD[1]< 0) then flag = -1;
INTERPRETATION
begin
if CrossesAboveThreshold(flag, 0.5) then sentiment = 100;
if CrossesbelowThreshold(flag, -0.5) then sentiment = 0;
end
plot (flag,blue,2);//@@@cs:221826-3389839-93083_cs@@@
I am using the MACD_NEO in the 'Express' to do this, is there a way to modify this to reverse position instead of close? Or is there any other way to do this?
EXPRESS MACD_NEO
VARS
series myMACD(MACD.main), flag ;
CALCULATION
if (myMACD[1]>= 0) then flag = 1;
if (myMACD[1]< 0) then flag = -1;
INTERPRETATION
begin
if CrossesAboveThreshold(flag, 0.5) then sentiment = 100;
if CrossesbelowThreshold(flag, -0.5) then sentiment = 0;
end
plot (flag,blue,2);//@@@cs:221826-3389839-93083_cs@@@