[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 45

 
Stells:

Good afternoon.

Please help me to extract values of Up_Line and Down_Line of ExTrendv2 indicator (attached) to the Expert Advisor.

I am trying the following way:

For Up_Line iCustom(NULL, 0, "ExTrendv2", 0, 0,1)

for Down_Line iCustom(NULL, 0, "ExTrendv2", 0, 1,1)

fails.


Doesn't an EA with such an indicator hang the terminal?
 

It doesn't seem to hang up in the tester.

Only I still can't get the values out, it just doesn't make any sense.

 
Hi all, I am trying to test the Expert Advisor on one symbol and 4 timeframes at the same time - I have a small problem - error 129 - wrong price at both open and close, the trade thread seems to be separated before sending orer and while(IsTradeContextBusy() || !IsTradeAllowed()){int Interval = MathRand()+1000;
Print("Trade thread is busy. Repeat check in "+DoubleToStr((Interval/1000),0)+" sec");
Sleep(Interval);} RefreshRates(); Does anybody know what this stuff is and how to deal with it?
 
Stells:

It doesn't seem to hang up in the tester.

Only I still can't get the values out, it just doesn't make any sense.


Try it this way, there are no parameters.

Up_Line iCustom(  NULL, 0, "ExTrendv2", 0,1);
Down_Line iCustom(NULL, 0, "ExTrendv2", 1,1);

Although the indicator recalculates everything on every tick.

 
Dimoncheg:
Hi all, I am trying to test the Expert Advisor on one symbol and 4 timeframes at the same time - I have a small problem - error 129 - wrong price at both open and close, the trade thread seems to be separated before sending orer and after close while(IsTradeContextBusy() || !IsTradeAllowed()){int Interval = MathRand()+1000;
Print("Trade thread is busy. Repeat check in "+DoubleToStr((Interval/1000),0)+" sec");
Sleep(Interval);} RefreshRates(); Does anybody know what this stuff is and how to deal with it?
ERR_INVALID_PRICE 129 Incorrect price


Normalize price to Digits before sending request to the server

 
Vinin:


Try it this way, there are no parameters

Although the indicator makes a full recalculation on every tick.

I regretted putting it on the chart. The terminal went into deep thought, and after 15 minutes I killed it
 
artmedia70:
ERR_INVALID_PRICE 129 Incorrect price


Normalise prices to Digits before sending request to server



Prices are of course normalized by NormalizeDouble(Ask,Digits) and NormalizeDouble(Bid,Digits), for sending orders I tried also Igor Kim's function, which is here - the same error occurs, because the function does not process it, it just tries to send the order five times and that's it. The error does not occur at every command to send an order, most orders still open. I have a feeling that this problem has something to do with the trade flow since in a certain case the error occurs when the EA wants to send several orders simultaneously at different timeframes of one symbol and one is usually sent out, while the rest get no success with this error.
 
Dimoncheg:

Prices are of course normalized by NormalizeDouble(Ask,Digits) and NormalizeDouble(Bid,Digits), for sending orders I tried also Igor Kim's function, which is here - the same error occurs, because the function does not process it, it just tries to send the order five times and that's it. The error does not occur at every command to send an order, most orders still open. I have a feeling that this problem has something to do with the trade flow since in a certain case the error occurs when the EA wants to send several orders simultaneously at different timeframes of one symbol but one order is usually sent but the others fail.

Immediately before using Ask and Bid, perform RefreshRates()
 
//-------------------------------------------------------------------+
extern int    TotalOrders    = 1;
//-------------------------------------------------------------------+
// Global variables
int Cnt = 0;              // counter variable, used in for() loops
    // only perform analysis and open new order if we have not reached our TotalOpenOrders max
    if(TotalOpenOrders() < TotalOrders)
    {
//+------------------------------------------------------------------+
//|-----------------------//  Orders Count  //-----------------------|
//+------------------------------------------------------------------+
// This function returns the total amount of orders the expert advisor has open  
int TotalOpenOrders()
{
  Cnt=OrdersTotal();
  int TotalOpenOrders = 0;
  if(Cnt==0)
  {
    return(0);
  }
    else
    {
    for(;Cnt>=0;Cnt--)
    {
      RefreshRates();
      OrderSelect(Cnt,SELECT_BY_POS);
      if(OrderMagicNumber()==Magic)
      {
      TotalOpenOrders++;
      }
    }
  }
  return(TotalOpenOrders);
}
 
artmedia70:
I regretted putting it on the chart. The terminal went into deep thought, after about 15 minutes I killed it

You don't look at the code before you put something up.
Reason: