Question for connoisseurs - page 14

 
Спасибо большое!
 
rid писал(а) >>

Good afternoon. I can't seem to get to grips with the use of an indicator in the EA.

Here is the indicator itself:



I am calling the indicator in the Expert Advisor like this ( values from 2 buffers)-

However, although in the visual mode I can see that the values of the indictor from both buffers change from zero to plus/minus five, but the Customs persistently show (return) zeros .....

Posted in comment. - The green line =5, but the comment shows zero.

I am trying to figure it out for the past hour. Please give me a hint where the error is.

I downloaded the tool itself.

I have found the error. I sent a test script to Misha.

In fact all parameters must be passed. String ones too.

Files:
level_1.mq4  2 kb
 
Thank you Vinin !
 

Good afternoon, please help the knowledgeable to concoct an oscillator on the formula heiken ashi showing the difference between haOpen and haClose. Thanks in advance!

 

Hi all !

Please advise. here is the code:

// Проверка условий для совершения сделки селл 
  if( если условия соотв.- ют заданным){ //продаем
StopLevel = MarketInfo(Symbol(),MODE_STOPLEVEL);
   
      SL=0; TP=0;
      if( StopLoss>0    && StopLoss> StopLevel)   SL=Bid+Point* StopLoss;
      if( TakeProfit>0 && TakeProfit> StopLevel) TP=Bid-Point* TakeProfit;
      if( StopLoss  < StopLevel && StopLoss>0)   SL = Bid+Point* StopLevel; 
      if( TakeProfit< StopLevel && TakeProfit>0) TP = Bid-Point* StopLevel; 
   ticket=OrderSend(Symbol(),OP_SELL, lots,Bid,3, SL, TP,"Name_Expert", Magic,0, clOpenSell);

                                                   }

Can't figure out what's wrong ! The tester log returns error 130 (wrong stops) if I set stoploss and takeprofit less than allowed!

But I have specifically provided that this error did not happen !

Please advise why the conditions do not work ? -


 if( StopLoss  < StopLevel &&   StopLoss>0)   SL = Bid+Point* StopLevel; 
 if( TakeProfit< StopLevel  && TakeProfit>0)   TP = Bid-Point* StopLevel; 
 
How about adding a one-two to StopLevel for clearance? It worked for me once.
 
Many beginners have a problem comparing floating point numbers. Granit77 is right, I usually add 0.1 pips instead of 1-2 pips to keep the Expert Advisor accurate
 
granit77 >> :
How about adding a one-two to StopLevel for the gap? It worked for me once.

Like this ? :

 if( StopLoss  < StopLevel &&   StopLoss>0)   SL = Bid+Point*( StopLevel+1); 
 if( TakeProfit< StopLevel  && TakeProfit>0)   TP = Bid-Point*( StopLevel+1); 

>> It doesn't work.

Besides, in the tester these conditions should work even without a gap. But they don't. - Error 130 is coming up

 
rid >> :

Not helpful.

Besides, in the tester these conditions should work even without a gap. But they do not. - Error 130 is showing

Not an expert, but would print out the values of StopLoss, TakeProfit, StopLevel, SL and TP variables.

Can't see how they are declared or why they are needed

 SL=0; TP=0
 
goldtrader >> :

Not an expert, but would print out the values of StopLoss, TakeProfit, StopLevel, SL and TP variables.

I cannot see how they are declared and what for

Here's how it's done:

extern int     StopLoss=1;
extern int     TakeProfit=1;
double SL, TP;
int StopLevel;

//---------------
StopLevel = MarketInfo(Symbol(),MODE_STOPLEVEL);

  if( УСЛОВИЯ ВХОДА ){ //продаем
   
      SL=0; TP=0;
      if( StopLoss>0    && StopLoss> StopLevel)   SL=Bid+Point* StopLoss;
      if( TakeProfit>0 && TakeProfit> StopLevel) TP=Bid-Point* TakeProfit;

      if( StopLoss  < StopLevel && StopLoss>0)   SL = Bid+Point* StopLevel; 
      if( TakeProfit< StopLevel && TakeProfit>0) TP = Bid-Point* StopLevel;
 
   ticket=OrderSend(Symbol(),OP_SELL, lots,Bid,3, SL, TP,"Name_Expert", Magic,0, clOpenSell);
   if( ticket < 0){
            Print("Ошибка открытия ордера SELL #", GetLastError()); 
            Sleep(10000);  
            prevtime = Time[1]; 
            return (0); 
         } 
       }

Positions are opened, but instead of stops there is an error 130 .....

Displayed all stops and levels in the comment . - all seems to be displayed correctly... - but error 130 is coming up