Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 474

 
polundra:

Help with advice. On the old version of the terminal my last tick price array worked, but on the new build 609 it no longer does.

The question is how to store the last, say, 20 ticks of price into the array?

I made it once upon a friend's request (indicator). The principle can be understood.
Files:
tickcount.mq4  3 kb
 
TarasBY:
Once upon a time, I sketched it out at the request of a comrade (indicator). The principle can be understood.
Thank you, I will look into it.
 

If you know how to put the martingale function in the code (for example this one), please advise. It should be enabled on a losing trade and after a profitable one it should return to the lot settings.



//+------------------------------------------------------------------+
//|                                                                  |    
//+------------------------------------------------------------------+
             //внешние переменные
extern int x = 5;
extern int y = 19;             
extern double TakeProfit = 300;
extern double stoploss = 300;
extern double Lots = 0.1;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double MA1, MA2;
   int cnt, ticket, total;
   MA1=iMA(NULL,0,x,0,MODE_SMA,PRICE_CLOSE,0);
   MA2=iMA(NULL,0,y,0,MODE_SMA,PRICE_CLOSE,0);
   total=OrdersTotal();
   if(total<1)//проверка количества ордеров 
     {
      // проверка свободных средств
      if(AccountFreeMargin()<(1000*Lots))//количество свободных средств
        {
         Print("Недостаточно средств = ", AccountFreeMargin());
         return(0);  
        }
      // открытие длинной позиции
      if(MA1>MA2)
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Ask+TakeProfit*Point,"-",0,0,Blue);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("открыта позиция BUY : ",OrderOpenPrice());
           }
         else Print("Ошибка при открытии BUY позиции : ",GetLastError()); 
         return(0);
        }
      // открытие короткой позиции
      if(MA1<MA2)
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+stoploss*Point,Bid-TakeProfit*Point,"-",0,0,Red);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("открыта позиция SELL : ",OrderOpenPrice());
           }
         else Print("Ошибка при открытии SELL позиции : ",GetLastError()); 
         return(0); 
        }
      return(0);
     }
   }
 
vasabu2012:
Question to knowledgeable people-problem arose recently: on the UPU signal to the mail has ceased to come, before everything was fine, now in the log terminal writes during the test: has been sant, but the mail does not come anything. UPU rebooted, terminal, too, no result.What can be the matter?

same problem.
 
Good evening admins, there is a lot of material, there is no systematization of the questions, so maybe the answer was already there. New build duplicates directories of folders and files into roaming folder, it is terribly inconvenient to work with parallel directories, advise how to avoid this problem, solve, or disable this roaming, etc.? Win 7 (32)
 
SergMich:
Good evening, Admins, the material is very complex, the questions are not systematized, so perhaps the answer has already been given. The new build duplicates the folders and files in the roaming folder, it is awfully inconvenient to work with parallel directories, suggest how to avoid this problem, solve it or disable roaming etc.? Win 7 (32)

Is it duplicating? It "moves" you there along with all your suitcases.

If you want to continue working in the local directory, use /portable key in the terminal shortcut and editor. This will create the MQL4 folder and the familiar directories in it.

 
artmedia70:

Is it duplicating? It "moves" you there along with all your suitcases.

If you want to continue working in the local directory, use the /portable switch in the terminal shortcut and editor



OK, how do you run this switch?
 
SergMich:

OK, how do you launch this key?
Do you know what a shortcut is?
 
artmedia70:
Do you know what a label is?

yes. next steps
 
All sorted, thank you! You can delete the post
Reason: