Download MetaTrader 5
To add comments, please log in or register
Use the Pocket to paste your content. It is convenient!
theo1996
10
theo1996 2015.04.21 13:45 

On the chart a ere actually two drawn SARS (green ones)and they have no difference.On the chart i even tried 10 and -10 -4 +4 nothing changes the value visually or numerically.

So i normally use my iSAR function without problem ,but when i run the tester on my EA i clearly see that i move my iSAR back the number of bars needed then it will be exactly on the spot for any operation.

So when i set shift to -1,-2,-3 ,0,1,2,3nothing happens absolutely nothing.It doent move the psar visually at least when i run my ea on positive shift it actualy changes my profit report but when i run negative shift the same number appears.

Also the two sars are not showing any difference in placement visually,is it happening only in numbers?

I try to create multiple arrows to draw the shifted sars but only the top one draws it self and not the others.

Also pls explain how shift works .

//+------------------------------------------------------------------+
//|                                                    Experts98.mq4 |
//|                                                             Theo |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Theo"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
// void functions change flobal vars without parsing them
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
/*/input string            InpName="ArrowCheck"; // Sign name
input int               InpDate=10;           // Anchor point date in %
input int               InpPrice=50;          // Anchor point price in %
input ENUM_ARROW_ANCHOR InpAnchor=ANCHOR_TOP; // Anchor type
input color             InpColor=clrRed;      // Sign color
input ENUM_LINE_STYLE   InpStyle=STYLE_DOT;   // Border line style
input int               InpWidth=5;           // Sign size
input bool              InpBack=false;        // Background sign
input bool              InpSelection=false;   // Highlight to move
input bool              InpHidden=true;       // Hidden in the object list
input long              InpZOrder=0;  
*/
void opensell()
  {

   ticket++;
   return;
  }
int ticket=0;
datetime date21=D'2015.03.31 21:00:00';
datetime date03=D'2015.03.31 3:00:00';
int shift =-1 ;
int shift2 =1 ;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()

  {
//---

   for(int i=1; i<4; i++)
     {
      opensell();
      Print(ticket);
      Print("The time is:",iTime(Symbol(),30,0));
     }
   datetime datenao=iTime(Symbol(),30,0);

   if(date21<=datenao && date03>=datenao)
     {
      Print("True");
     }
   else Print("false");

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   datetime datenao=iTime(Symbol(),30,0);
   if(3<Hour() && Hour()<21)
     {





     }

   else
     {
      Print("false",iTime(Symbol(),30,0));
      Comment("false","time",iTime(Symbol(),30,0),"Trade not allowed  ",MarketInfo(Symbol(),MODE_TRADEALLOWED));
     }
   double price1=iSAR(Symbol(),30,0.005,0.15,0)+0.002;
   double price2=iSAR(Symbol(),30,0.005,0.15,0)-0.002;
   double price3=iSAR(Symbol(),30,0.005,0.15,0)+0.002;
   double price4=iSAR(Symbol(),30,0.005,0.15,0)-0.002;
   string arrowname=StringConcatenate("ellispe",TimeToStr(iTime(Symbol(),30,0)));
   

   RefreshRates();
   arrowname=StringConcatenate("ARROWBUY",TimeToStr(iTime(Symbol(),30,shift)));
   ObjectCreate(0,arrowname,OBJ_ARROW_CHECK,0,iTime(Symbol(),30,0),price2);
   Print(iTime(Symbol(),30,0),GetLastError());
   arrowname=StringConcatenate("ARROWBUY",TimeToStr(iTime(Symbol(),30,shift)));
   ObjectCreate(0,arrowname,OBJ_ARROW_BUY,0,iTime(Symbol(),30,0),price1);
   Print(iTime(Symbol(),30,0),GetLastError());
   RefreshRates();

   RefreshRates();
      arrowname=StringConcatenate("ARROWBUY",TimeToStr(iTime(Symbol(),30,shift2)));
   ObjectCreate(0,arrowname,OBJ_ARROW_SELL,0,iTime(Symbol(),30,0),price3);
   Print(iTime(Symbol(),30,0),GetLastError());
   RefreshRates();


   arrowname=StringConcatenate("ARROWBUY",TimeToStr(iTime(Symbol(),30,shift2)));
   ObjectCreate(0,arrowname,OBJ_ARROW_BUY,0,iTime(Symbol(),30,0),price4);
   Print(iTime(Symbol(),30,0),GetLastError());

  }
//+------------------------------------------------------------------+
Files:
/
To add comments, please log in or register