Coding help - page 575

 
tfi_markets:
Just getting long Signals from Indicator.Bool operator may bewrongly addressed?!

Hi pro-coders,

I wonder if someone could help me with my code based custom indicator with bool operators:

double Trendup=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,0,BarShift);

double Trendup1=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,0,BarShift+1);

double Trenddown=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,1,BarShift);

double Trenddown1=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,1,BarShift+1);

bool BUY=false;

bool SELL=false;

if (Trendup>0 && Trendup!=EMPTY_VALUE && !(Trendup1>0 && Trendup1!=EMPTY_VALUE)) BUY=true;

if (Trenddown>0 && Trenddown !=EMPTY_VALUE && !(Trenddown1>0 && Trenddown1!=EMPTY_VALUE)) SELL=true;

//|---------Entry Conditions

if(BUY=true){if(ReverseTheSystem)SV=1;else BV=1;break;} // BUY

if(SELL=true){if(ReverseTheSystem)BV=1;else SV=1;break;} // SELL

For some reason I am just getting long signals. Short signals will not appair at all. (see screenshot)

Thank you for your help!

tfi_markets

Can you post the "Trend" indicator (so that it can be tested how it works)?

 

Good day!sorry for my English,I use translator.Help,there are two counselors but they only work in tester(((no source code(please Help to correct Advisor or who has a working version please share. 222222.ex4 111111.ex4

Files:
222222.ex4  308 kb
111111.ex4  128 kb
 
mladen:

tfi_markets

Can you post the "Trend" indicator (so that it can be tested how it works)?

Hi Mladen,

please find the "trend" indicator attached to this posting.

Thank you for looking into this.

With kind regards,

T.

Files:
trend.mq4  4 kb
 
tfi_markets:

Hi Mladen,

please find the "trend" indicator attached to this posting.

Thank you for looking into this.

With kind regards,

T.

tfi_markets

Try something like this :

double val0=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift);

double val1=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift+1);

double val2=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift+2);

if ((val0-val1)*(val1-val2)<0)

{

if (val0>val1) // code for buy

if (val0<val1) // code for sell

}

 

Hi Mladen,

thank you for looking into my issue. I have implemented your code like this:

double val0=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift);

double val1=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift+1);

double val2=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift+2);

bool BUY=false;

bool SELL=false;

if ((val0-val1)*(val1-val2)<0)

{

if (val0>val1) BUY=true; // code for buy

if (val0<val1) SELL=true; // code for sell

}

if(BUY=true){BV=1;break;}// BUY

if(SELL=true){SV=1;break;} // SELL

but it is still just delivering "long" signals.

Could you please look into this once more?

Thank you in advance!

With kind regards,

T.

 
tfi_markets:
Hi Mladen,

thank you for looking into my issue. I have implemented your code like this:

double val0=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift);

double val1=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift+1);

double val2=iCustom(NULL,0,"Trend",TMperiod,Intensity,SL_distance_pips,2,BarShift+2);

bool BUY=false;

bool SELL=false;

if ((val0-val1)*(val1-val2)<0)

{

if (val0>val1) BUY=true; // code for buy

if (val0<val1) SELL=true; // code for sell

if(BUY=true){BV=1;break;}// BUY

if(SELL=true){SV=1;break;} // SELL

}

but it is still just delivering "long" signals.

Could you please look into this once more?

Thank you in advance!

tfi_markets

That "trend" indicator is not updating current bar. But since it is a decompiled code, I think you should get the original code in order to see what is going wrong

The code snippet I posted is OK and in case when the indicator that is called works correctly, it will issue correct signals too

 

Mladen will help?post # 5748

 
Vlad5624:
Mladen will help?post # 5748

Vlad5624

Can not change ex4 file. Sorry

 
mladen:

Vlad5624

Can not change ex4 file. Sorry

And you have not seen before such a EA?

 
Vlad5624:
And you have not seen before such a EA?

Vlad5624

No, I did not, Completely unfamiliar with 11111 and 22222 EAs

Reason: