Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1103

 
MIKHAIL VINOGRADOV:

Greetings!

I can't close opposite orders of different lots using CTrade.PositionCloseBy(ticket1,ticket2).

ResultRetCode() - I get error 10035.

Please advise what is the reason?

10035

TRADE_RETCODE_INVALID_ORDER

Invalid or prohibited order type


Watch carefully what you are doing there.

 

Do I understand correctly - the SetIndexBuffer function is needed to bind buffer(s) to a specific graphic construction, AND TO NUMBER ACCESS TO THEM THROUGH iCustom ?

So, for example, if I create an array for High prices, then it's just enough to declare it without binding via SetIndexBuffer and in ...

#property indicator_buffers

... ... it can be ignored.

Besides, with SetIndexBuffer you can bind arrays of double type only, while datetime and other arrays cannot.


I just don't fully understand this point (or understood it), and now I have an idea - I want to clarify it...

 
Alexandr Sokolov:

Do I understand correctly - the SetIndexBuffer function is needed to bind buffer(s) to a specific graphic construction, AND TO NUMBER ACCESS TO THEM THROUGH iCustom ?

So, for example, if I create an array for High prices, it's just enough to declare it without binding via SetIndexBuffer and in ...

... ... it can be ignored.

Besides, with SetIndexBuffer you can bind arrays of double type only, while datetime and other arrays cannot.


I just don't fully understand this point (or understood it), and now I have an idea - I want to clarify it...

It's not a construction, it's a dataset. Therefore, I don't think it will work that way. Although I didn't check it.

As for datetime type, you can write it to double and apply it by force when reading.

 
Happy:

Good morning.

Question. In the tester, at the daylight-side interface (when the next day line passes) the program should have placed a pending order. The pending order that was already there and the price touched it, it got opened but the instruction to open anotherpending order was ignored by the system for some reason. Can this also happen in a real account where the robot instructions are simply ignored and therefore the required action is not performed?


And another question. I am running a Strategy Tester but I was very confused by the fact that it goes a week or so in the visualization and then displays the following message

177564 tick events (447 bars, 7888506 bar states) processed in 0:17:42.694 (total time 0:17:48.217)

177564 tick events (447 bars, 7888506 bar states) processed at 0:17:42.694 (total time 0:17:48.217)

I don't get it, is he too busy to keep testing? Or he is so caring and worried about resources of my computer? I don't see any error messages. It simply terminates itself. Though I've set the date not 7 days, but 7 months. I'd like to see the entire test path from start to finish.

What religion does not allow him to visually test for example a year or several years? And you can visually see how your program worked during the previous year, for example.


And one more question. (Although it may be unanswered)) ) How can it happen that the tester 2 laps working as it should, and just before the above-mentioned inscription on the day just ignores all instructions. How is it possible the program worked correctly for several rounds (opened orders and then closed them), and then, boom, it ignores everything. It opens and closes neither. Is it because of the end of a testing period or there are other reasons?

 
brent and wti charts on the main ftm website screen are different from the quotes themselves in my personal account. Any thoughts? I am sure that the management of the charts in particular the oil charts is done inside ftm's "kitchen". There is no explanation. The proof is in the photo at the same time the prices in my personal cabinet differ in the opposite direction from the real ones and are always minus for the trader. It smells like a scam...
 
Yevhenii Levchenko:

........... But at a certain point it needs to determine if it closed its own trade or if it was someone else who got in and closed it....

Write unambiguously, are you asking how to prescribe or about using an EA without editing

 
how can I handle error 4403?
 

  • Hello!

    I wanted to use the A/D indicator for my EA, but not in its pure form, its moving average.

    That's why I made up functions:

    //+------------------------------------------------------------------+

    //| A/D function |

    //+------------------------------------------------------------------+

    double A_D(ENUM_TIMEFRAMES tf, int shift)

    {

    double res=0;



    res=iAD(NULL,tf, shift);



    return res;





    }



    //+------------------------------------------------------------------+

    //| A/Dfunction |

    //+------------------------------------------------------------------+

    double A_D_moving(ENUM_TIMEFRAMES tf, int period)

    {

    double res=0;

    double a[];





    for(int i=period; i>=1; i--)

    {

    a[i]= A_D(tf, i);

    }



    for(int i=period; i>=1; i--)

    {

    res=iMAOnArray(a,0,period,0,MODE_SMA,0);

    }



    return res;





    }

    But during testing, it became obvious that A_D_moving() is buggy in this revision, as there is a critical error when running the test.

    Please who can help:

    How correct is A_D_moving() written? If there are errors, please indicate...

    Thank you!


 
AurelianoV:

Please insert the code correctly:


 
Artyom Trishkin:

Please insert the code correctly:


Sorry1

/+------------------------------------------------------------------+
//|  Функция A/D                       |
//+------------------------------------------------------------------+
double A_D(ENUM_TIMEFRAMES tf, int shift)
  {
   double res=0;
   res=iAD(NULL,tf, shift);
   return res;
  }

//+------------------------------------------------------------------+
//|  Функция A/D                       |
//+------------------------------------------------------------------+
double A_D_moving(ENUM_TIMEFRAMES tf, int period)
  {
   double res=0;
   double a[];
   
   for(int i=period; i>=1; i--)
     {
      a[i]= A_D(tf, i);
     }
   for(int i=period; i>=1; i--)
     {
      res=iMAOnArray(a,0,period,0,MODE_SMA,0);
     }
   return res;
  }


sorry

Reason: