I am trying to add a modification to an EA to close close trades when Nonlagma_V7 changes colour. I can get it to work in a small test EA but for some reason I can't get it to work where I need it.
Buffer 3 = 1 for trend up and -1 for trend down.
nTrdL & nTrdS add 1 with each addition trade opened as price goes up/down.
If I can change to if (nTrdL>=2)y=ExitTrades..... the trades close with no problem.
I am sure it something simple but I am a new beginner to coding EA's so any pointers would be appreciated. I have tried paying people to do this for me but keep ending up with quick and dirty short cuts.
Thanks Fourxxxx
Buffer 3 = 1 for trend up and -1 for trend down.
nTrdL & nTrdS add 1 with each addition trade opened as price goes up/down.
If I can change to if (nTrdL>=2)y=ExitTrades..... the trades close with no problem.
PHP Code
bool CloseNhedgeL=false;
bool CloseNhedgeS=false;
PHP Code
double Nontrend=iCustom(Symbol(),0,"NonLagMA_v7",Price,Length,Displace,PctFilter,Color,ColorBarBack,Deviation,SoundAlertMode,3,1);
if (nTrdL>0&&Nontrend<0)CloseNhedgeL=true;
if(y==0)
{
if ((CloseNhedgeL==true)&&nTrdL>=2)y=ExitTrades(H,DarkViolet,"NHedge Profit Lock Activated",ThO); //Madness
nTrdS=0;
}
if (nTrdS>0&&Nontrend>0)CloseNhedgeS=true;
if(y==0)
{
if ((CloseNhedgeS==true)&&nTrdS>=2)y=ExitTrades(H,DarkViolet,"NHedge Profit Lock Activated",ThO); //Madness
nTrdL=0;
}
Thanks Fourxxxx