[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 543

 
Reshetov писал(а) >>

Where period1 or period2 insert PERIOD_D1


Yura, you have not mixed up anything.
Put it where 0 is (where the timeframe should be)
double m1=iMA(NULL,PERIOD_D1,period1,0,1,0,0);
double m2=iMA(NULL,PERIOD_D1,period2,0,1,0,0);
затем  if(m1>m2) {okbuy=1;} бла бла бла 
 
Vinin >>:


Юра, ничего не перепутал.
Ставить там где 0 стоит (где должен таймфрейм стоять)


Thank you very much, it works
 
Can you please tell me how to modify the WPR indicator to show data for a specific currency instead of the current one? The code is attached.
Files:
wpr.mq4  3 kb
 
unnnamed писал(а) >>
Can you please tell me how can I modify WPR indicator to show not the current currency but a specific one? The code is attached.


Try this variant. It is not so good, of course.
Files:
wprr1a.mq4  3 kb
 
Anyway, maybe somebody will try to make the ClosePositions( string sy = "", int op = -1, int mn = -1 ) function in the Expert Advisor.
EA https://www.mql5.com/ru/forum/111497/page542
If there is an error, please tell me where

 
gince писал(а) >>
Maybe someone will try to make the ClosePositions( string sy = "", int op = -1, int mn = -1 ) function in the Expert Advisor.
EA https://www.mql5.com/ru/forum/111497/page542
If there is mistake, please tell me where



If the question is about me, I do not like parsing other people's code. If it's not up to me, then maybe there will be some eager
 
I don't even know who to go to, I just need help

int GetTradeSignal_Strategija_1(string sym = "", int tf = 0) 
{
   if (sym == "") sym = Symbol();
   
   //int   magic_1     = Magic+1;
   int   stShift_1   = 0;
   int   type        = 0;
   int   IdMain      = 12; // main line
   int   IdBull      = 12; // bull line 
   int   IdBear      = 12; // bear line 
   int   IdArray     = 12; // all sma line  

   //double BullPressue_0     /*melynas stulpas*/  =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,0,stShift_1);       //
   double BullPressue_1       /*melynas stulpas*/  =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,0,stShift_1+1);     //
   //double BearPressue_0     /*rudas stulpas*/    =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,1,stShift_1);       //
   double BearPressue_1       /*rudas stulpas*/    =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,1,stShift_1+1);     //Bull SMA
   double MainAccumulation_0  /*balta*/            =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,2,stShift_1);       //balta linija
   double MainAccumulation_1  /*balta*/            =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,2,stShift_1+1);     //balta linija
   double MainSMA_0           /*raudona*/          =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,5,stShift_1);       //raudona linija
   double MainSMA_1           /*raudona*/          =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,5,stShift_1+1);     //raudona linija
   double BullSMA_0           /*zalia*/            =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,6,stShift_1);       //
   double BullSMA_1           /*zalia*/            =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,6,stShift_1+1);     //
   double BearSMA_0           /*violetine*/        =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,7,stShift_1);       //
   double BearSMA_1           /*violetine*/        =iCustom(sym,tf,"MarketWay",IdMain,IdBull,IdBear,IdArray,0,7,stShift_1+1);     //
   
   
      //---CLOSE BUY---
    if((  MainAccumulation_1-MainSMA_1>0        // jei balta1 linija auksciau raudonos1
      &&  MainAccumulation_0-MainSMA_0<0)       // jei balta0 linija zemiau raudonos0
      ||( MainAccumulation_1-BullSMA_1>0.1      // jei balta1 linija auksciau zalios1
      &&  MainAccumulation_0-BullSMA_0<0))      // jei balta0 linija zemiau zalios0
                
      type = 2; 
   
      //---CLOSE SELL---
   if((  MainAccumulation_1-MainSMA_1<0         // jei balta1 linija zemiau raudonos1
      &&  MainAccumulation_0-MainSMA_0>0)       // jei balta0 linija auksciau raudonos0
      ||( MainAccumulation_1-BullSMA_1<0.1      // jei balta1 linija zemiau zalios1
      &&  MainAccumulation_0-BullSMA_0>0))      // jei balta0 linija auksciau zalios0
                
      type = -2;
   
      //---OPEN BUY---
   if(   MainAccumulation_1-MainSMA_1>0      // jei balta linija zemiau raudonos
      && BullPressue_1-Point>0               // jei melynas stulpas > 0
      && BearPressue_1-Point>0               // jei rudas stulpas> 0
      && MainSMA_1<MainSMA_0                 //raudona kylanti
      && MainAccumulation_1-Point>0          // jei balta linija> 0
      && OrdersTotal()<=1)         
      
      type = 1; 

      //---OPEN SELL---
   if(   MainAccumulation_1-MainSMA_1<0      
      && BullPressue_1-Point<0               
      && BearPressue_1-Point<0
      && MainSMA_1>MainSMA_0               
      && MainAccumulation_1-Point<0
      && OrdersTotal()<=1)
      
      type = -1; 
        
      Comment("type = ",type);//тут коментатий показывает type = 2 и type = -2, значет тут хорошо

 return(type);
}
Next
void ManagePositions_Strategija_1(double StopLoss=0,double TakeProfit=0) 
{
  double lotas = Lotas;
  double sl = 0, tp = 0;
  int    bs = GetTradeSignal_Strategija_1(Simbolis,tf);
  int    mn = Magic * 1;
     
  //ExistPositions(string sy="", int op=-1, int mn=-1, datetime ot=0) 
  if (ExistPositions(Simbolis,-1,mn)) 
  {
      //ClosePositions(string sy="", int op=-1, int mn=-1)             //функция KimIV
    if (bs == -2)  ClosePositions(string sy="", int op=-1, int mn=-1); //тут незакрывает  ???????   почему    ???????????
    if (bs == 2)   ClosePositions(string sy="", int op=-1, int mn=-1); //тут незакрывает  ???????   почему    ???????????
  }                                                                    // в журнале ошибки нет

  if (!ExistPositions(Simbolis,-1,mn))  
  {
    if (bs == 1) 
    {
      if (StopLoss   != 0) sl = Ask - StopLoss   * Point;
      if (TakeProfit != 0) tp = Ask + TakeProfit * Point;
      OpenPosition(Simbolis, OP_BUY, lotas);                //опен работает, то есть отрывает
    }
    if (bs == -1) 
    {
      if (StopLoss   != 0) sl = Bid + StopLoss   * Point;
      if (TakeProfit != 0) tp = Bid - TakeProfit * Point;
      OpenPosition(Simbolis, OP_SELL, lotas);               //опен работает, то есть отрывает
    }
  }
}
 
Please help, do the local variables in the start() function reset their value at every new tick?
 
Doesn't work, but it's clear where to start, thank you very much.
 
Good day to all. Can you tell me if it's possible to create a form with a set of buttons in MQL4, so certain functions can be executed on an event.