[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 303

 
granit77:
I agree, there was a vigorous discussion about speed. Vinin and Integer were for the individual indicators.
I believe them :))

Hello! Sorry for the insistence, but if you don't mind, could you please advise me?

With iCustom I get an indicator signal in the EA, but the EA only opens trades in one direction, depending on the condition of that part .

// ----- буферы индикатора

double   ArrowDownBuffer[];
double   ArrowUpBuffer[];

//------ получение сигнала в советнике


double db=iCustom(NULL,0,"GetSignal",0,SignalBar);// Стрелка вниз
double ub=iCustom(NULL,0,"GetSignal",1,SignalBar);// Cтрелка вверх
 
 
 bool BuySignal=false;
 bool SellSignal=false;
 
//-----------------------------------------------------------------------------------+
//Проверка на сигнал
if(db!=1)
 {
  SellSignal=true;
 }
if(ub!=1)
 {
  BuySignal=true;
 }
   

   
 //------------------------------------------------------- check for long position (BUY) possibility
      if( BuySignal ) 
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"MA",MN,0,Green);
         


 
skyjet:

Hello! Sorry for the insistence, but if you don't mind, could you please advise me?

With iCustom I get an indicator signal in the EA, but the EA only opens trades in one direction, depending on the condition of that part .

There is nothing more tiresome than looking for errors in other people's code. And I am not a programmer.

Look at how the opening block by the arrow indicator is made in the wizard. There is also a limit on the number of orders.

         #property copyright "Integer"
         //..............................  
         double bv=iCustom(NULL,TimeFrame,IND,PatternLength,PatternID,UsePatternStr,BuyPatternStr,0,1);
         double sv=iCustom(NULL,TimeFrame,IND,PatternLength,PatternID,UsePatternStr,BuyPatternStr,1,1);
         
         bool BuySignal=false;
         bool SellSignal=false;
            if(bv!=0 && bv!=EMPTY_VALUE){
               BuySignal=true;
            }
            if(sv!=0 && sv!=EMPTY_VALUE){
               SellSignal=true;
            }
            
            if(BuySignal || SellSignal){
               if(CloseOnRev)fOrderCloseMarket(SellSignal,BuySignal);
               int BuyCount,SellCount;
               int Total=fMarketOrdersTotal(BuyCount,SellCount);
                  if(Total==-1){
                     return(0);
                  }
                  if(Total<MaxCount || MaxCount==-1){
                     if(BuySignal){
                        if(BuyCount<MaxBuyCount || MaxBuyCount==-1){
                           if(LastBuyTime!=iTime(NULL,TimeFrame,0)){
                              fOrderOpenBuy();
                           }  
                        }
                     }
                     if(SellSignal){
                        if(SellCount<MaxSellCount || MaxSellCount==-1){
                           if(LastSellTime!=iTime(NULL,TimeFrame,0)){
                              fOrderOpenSell();
                           }
                        }
                     }
                  }
                  
            }
            
 
skyjet:

Hello! Sorry for the insistence, but if you don't mind, could you please advise me?

With iCustom I get an indicator signal in the EA, but the EA only opens trades in one direction, depending on the condition of that part .


I would also have to look at those conditions
 
Vinin:

But it's better not to transfer the indicator code to the expert - there will be lags
What should I do? Should I use iCustom to receive data for the Expert Advisor?
 
Alexandr24:
How do I get data for the examiner via iCustom?

An optimal variant, if the code of the indicator is optimal. Otherwise, you can speed up the processing
 
Vinin:

I should have looked at these conditions

Checking for a signal, at first both on buy and on sell was db/ub == 0 only opens long trades


after the signal became db!=1, ub!=0 only opens short positions

I put db!=0 and ub!=!0 it does not open deals at all

//------ получение сигнала в советнике


double db=iCustom(NULL,0,"GetSignal",0,SignalBar);// Стрелка вниз
double ub=iCustom(NULL,0,"GetSignal",1,SignalBar);// Cтрелка вверх
 
 
 bool BuySignal=false;
 bool SellSignal=false;
 
//-----------------------------------------------------------------------------------+
//Проверка на сигнал
if(db!=1)
 {
  SellSignal=true;
 }
if(ub!=1)
 {
  BuySignal=true;
 }
 
skyjet:

Checking for a signal, at first both on buy and on sell was db/ub == 0 only opens long trades


after the signal became db!=1, ub!=0 only opens short positions

I put db!=0 and ub!=!0 trades did not open at all


Doesn't tell you anything, especially if the indicator is curved
 
Vinin:

Doesn't tell you anything, especially if the indicator is crooked

I have monitored the operation of the indicator, and I have not noticed any problems with it.

But if you say it is crooked, what is there to check?

 
skyjet:
MetaEditor
Thank you!
 

Good evening! Can you tell me the difference between

text and text mark?

OBJ_TEXT 21 Text
OBJ_LABEL 23 Text label.