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

 
Sepulca:


You can try this as a quick fix:

You get a file like this:

To stop adding to the file, you must manually delete the global variable STEP.

Thanks Sepulca! I'll give it a try.
 

The question is this:

How do I set the values of the elements of an array if it has many elements?

At the moment I have the following working version:

On the global level, it is declared as follows:

int g_maPeriod[2];

In init():

g_maPeriod[1] = i_fastMaPeriod;
g_maPeriod[2] = i_slowMaPeriod;

But this is if only 2 external parameters. The tutorial says that you can only assign values to an array element by element, which is what I did.

Why can't it be done, for example, like this?

g_maPeriod[2] = {i_fastMaPeriod,i_slowMaPeriod};

After all, if it's declared globally, it can be done this way:

g_maPeriod[2] = {10,21};

This is allowed, but when variables are passed toinit() instead of numeric values, it's not... It's strange.

 

advise if there is an advisor that would close all trades on a chart

 
boris1209:

advise if there is an advisor that would close all trades on a chart


Go to
Files:
close.mq4  2 kb
 
pako:

at
script "close first market order if it is first in the list"
 
Roll:
script "close first market order if it is first in the list"
 

Good afternoon! I don't understand, everything seems to be in order, but it won't put a position.

if (OrderType()==OP_BUY)
         {   
             
                                                BPrice6=0; Price_SELL=Bid- Dist*Point;
              TP_SELL= ( Price_SELL-TP*Point);  SL_SELL= (Price_SELL+ SL*Point); 
 Print ( " Bid " , Bid ,"  Price_SELL " , Price_SELL ,"  TP_SELL " , TP_SELL ,"  SL_SELL " ,  SL_SELL );          
                        Sleep(2000); RefreshRates();for( A=25;A>=0;A--){if(IsTradeAllowed())break;
if(A==0) Comment(" эксперту не разрешено торговать или поток для выполнения торговых операций занят "); }
  tycc=OrderSend (Symbol( ), OP_SELLSTOP,  Lot*3*K ,NormalizeDouble(Price_SELL, Digits), 5, NormalizeDouble( SL_SELL,Digits),  NormalizeDouble( TP_SELL,Digits), NULL, 450, 0, CLR_NONE);
            Error=GetLastError();  errorcomment = "Ошибка открытия  ордера SELLSTOP "  + " " + Symbol() +  " " + ErrorDescript(Error); 
            Print (errorcomment);
            Sell_закрылся_по_TP=0;

2013.02.13 19:15:37 2007.11.15 08:55 Version_dynamic_with_understanding_Alex_WearwolfTry GBPUSD,H4: Bid 2.0611 Price_SELL 2.0511 TP_SELL 2.0226 SL_SELL 2.0711

2013.02.13 19:15:37 2007.11.15 08:55 Version_dynamic_with_Alex_WearwolfTry GBPUSD,H4: OrderSend error 4051

 
Dimka-novitsek:

Good afternoon! I don't understand, everything seems to be in order, but it won't put a position.

2013.02.13 19:15:37 2007.11.15 08:55 Version_dynamic_with_Alex_Wearwolf try GBPUSD,H4: Bid 2.0611 Price_SELL 2.0511 TP_SELL 2.0226 SL_SELL 2.0711

2013.02.13 19:15:37 2007.11.15 08:55 Version_dynamic_with_Alex_WearwolfTry GBPUSD,H4: OrderSend error 4051

Comment text, parameter 8. "NULL" in quotes.

something like this.

 
Thanks!!!! Let's have a look!
 
But I have NULL without inverted commas everywhere, and everywhere it goes?
Reason: