I have an EA and I want to access 2 lines from an indicator within the EA the lines in the indicator are.
expression 1
if(iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i) > zigzag1 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i) != 0 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i) != EMPTY_VALUE) ExtMapBuffer2[i]=iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i); else ExtMapBuffer2[i] = 0.0;;
expression 2
if(iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i) < zigzag1 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i) != 0 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i) != EMPTY_VALUE) ExtMapBuffer1[i]=iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i); else ExtMapBuffer1[i] = 0.0;
I want to say in the EA
when expression 1 is true Buy & close sell if open
when expression 2 is true sell & close Buy if open
How can I do this?
I tried something like
double Buy1_1 = iCustom(NULL, 0, "Trend", 96, Current + 0);
double Buy1_2 = 0;
double Sell1_1 = iCustom(NULL, 0, "Trend", 97, Current + 0);
double Sell1_2 = 0;
double CloseBuy1_1 = iCustom(NULL, 0, "Trend", 96, Current + 0);
double CloseBuy1_2 = 0;
double CloseSell1_1 = iCustom(NULL, 0, "Trend", 97, Current + 0);
double CloseSell1_2 = 0;
expression 1
if(iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i) > zigzag1 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i) != 0 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i) != EMPTY_VALUE) ExtMapBuffer2[i]=iMA(NULL,0,Period(),1,MODE_SMA,PRICE_HIGH,i); else ExtMapBuffer2[i] = 0.0;;
expression 2
if(iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i) < zigzag1 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i) != 0 && iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i) != EMPTY_VALUE) ExtMapBuffer1[i]=iMA(NULL,0,Period(),1,MODE_SMA,PRICE_LOW,i); else ExtMapBuffer1[i] = 0.0;
I want to say in the EA
when expression 1 is true Buy & close sell if open
when expression 2 is true sell & close Buy if open
How can I do this?
I tried something like
double Buy1_1 = iCustom(NULL, 0, "Trend", 96, Current + 0);
double Buy1_2 = 0;
double Sell1_1 = iCustom(NULL, 0, "Trend", 97, Current + 0);
double Sell1_2 = 0;
double CloseBuy1_1 = iCustom(NULL, 0, "Trend", 96, Current + 0);
double CloseBuy1_2 = 0;
double CloseSell1_1 = iCustom(NULL, 0, "Trend", 97, Current + 0);
double CloseSell1_2 = 0;