[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 121

 
Lians:

Thank you! If it's a script, it might work - a script can work as an EA if you put it in experts.

As for the Expert Advisor, I have not been able to compile it and encountered some errors in the end:

'GetNameOP' - function is not defined C:\Program Files (x86)\IamFX MT4\experts\VirtTPSL-Tr_EA.mq4 (45, 31)
'ErrorDescription' - function is not defined C:\Program Files (x86)\IamFX MT4\experts\VirtTPSL-Tr_EA.mq4 (45, 49)
Even after the fixes - 2 custom functions are missing.

Igor Kim's Functions

https://www.mql5.com/ru/forum/107476/page6#69097

And 'ErrorDescription', insert it at the beginning of the code

#include <stdlib.mqh>             // Стандартная библиотека 
 
Roll:
copied, pasted, corrected some errors, the result -- the code in the 4 digit tester works:

really everything works. don't understand what happened. the code didn't change, yesterday it didn't work, but today it does. maybe it's my Vista brain that's messing with it?
 
r772ra:

Let's see if step=0

what sl and tp will be equal to

And the person who raised this question should set order sl=0, tp=0 and then modify it.

This must be it.


1. The "dude" has Step=100(on the 5 digits).
2. If setting an order goes according to your scenario, then :
a) first setting an order with zero stops -- any problems? ;
b) then modify this order in compliance with the "Requirements and limitations of trading operations".
 

Roll:

1. У "чела" Step=100(на 5-ти знаке)

The question is closed, and as if for an allowance

Here, in the DC you know (let's not say which one) MODE_STOPLEVEL=0

 

Help with a problem. I need to add a comment to the EA, so that in the tester the drawdown is displayed as a percentage, calculated by the formula: Drawdown = ((Balance - Equity)/Balance * 100)*-1, and I did it:

double Prosadka = ((AccountBalance() - AccountEquity()) / AccountBalance() * 100)*(-1);

Comment("Просадка = ", DoubleToStr(Prosadka, 2),"%");

But I also need the maximum drawdown, which was for the run. That's it I do not even know how to do. Tell me at least which end to take, because I've never done such a thing. Thank you.

 
Roll:
People need to know their heroes - please send details of the DC in a private message.
starts with an al and ends with a bet))))
 
alsu, thank you. )
 

Help with the code.

There is code that prints zigzag data to a file for ( extern int Bars_count=10080;) the number of bars. How can I set the data for a period of time (extern int Time_Period=10080;) in minutes? It is needed for analysis on different TFs within the same period of time. And how to automatically determine the value of the arrays double zz_arr[10000], zz_arr_Abs[10000] ? This is to take as much data from the zigzag indicator as needed for the calculation of a period of time (extern int Time_Period=10080;) .

Code:

//+------------------------------------------------------------------+
//|                                                           ZZ.mq4 |
//|                      Copyright © 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//indikatoriaus zz kintamieji
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;

extern int Bars_count=10080;                  //Is kiek baru skaiciuosime
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function    
//+------------------------------------------------------------------+
int start()
  {
//----
   if( !NewBar() ) return(0);
   double zz_arr[10000],zz_arr_Abs[10000];
   double preZz=0;
   int i,ii;
    int handle;
          
        handle=FileOpen("array.txt",FILE_CSV|FILE_WRITE,";");
        Print("**********************",handle,"***********************");
   for(i=0;i<=Bars_count;i++)
   {
       double zz = iCustom(NULL,0,"ZigZag",ExtDepth,ExtDeviation,ExtBackstep,0,i); 
      if(zz!=0)
      {
         if(preZz==0)
         {
            preZz=zz
            ;continue;
         }
        zz_arr[ii]=(zz-preZz)/Point;
        if(handle>0)
        /* {
            FileWrite(handle, zz_arr[ii-1]);
         }*/  
        preZz=zz;
        ii++;
        Print(zz_arr[ii-1], "    ii = ", ii - 1);
        zz_arr_Abs[ii-1]=MathAbs(zz_arr[ii-1]);  
        if(handle>0)
         {
            FileWrite(handle, zz, zz_arr[ii-1], zz_arr_Abs[ii-1],ii-1,';');
         }                       
        Print("                      ",zz_arr_Abs[ii-1], "    ii = ", ii - 1);
     }
   }
   FileClose(handle);
  
  ArrayResize(zz_arr,ii);
  Print("-------------------------------------------------");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Iaia?o?aiea iiaiai aa?a
//+------------------------------------------------------------------+
bool NewBar() 
  {
//----
   static datetime NewTime;               // A?aiy oaeouaai aa?a
   bool NewBar=false;                     // Iiaiai aa?a iao
   if( NewTime!=Time[0] )
     {
      NewTime=Time[0];                    // Oaia?u a?aiy oaeia
      NewBar=true;                        // Iieiaeny iiaue aa?
     }
//----
   return(NewBar);
  }
//+------------------------------------------------------------------+
 
The period in minutes can be converted to bars using iBarShift(), the size of arrays can be set to the same size as the bars, then it will knowingly hold all the needed data. Note that variable ii is not initialized in any way in the code, so it can work spontaneously with errors.
 
good evening everyone, help me to prescribe a stop loss in an advisor
Reason: