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

 
Can you guys please tell me what time it is 5pm EST and 4:59EST on Kiev time?
 
131:
Can youguys please tell me what time it is 5pm EST and 4:59EST in Kiev?

Here you go, kid.

ETS = UTC-5
MSK = UTC+3
Kiev = UTC+2

 
abolk:

Here you go, kid.

ETS = UTC-5
MSK = UTC+3
Kiev = UTC+2


Thanks. :)
 

Good afternoon everyone!!!

Good people, can you tell me!!!!!!

THIS IS HOW???? Decided to tweak the advisor a little bit.... tweaked.... compiled....

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//Рассчитываем значения OsMA и Stochastic на 0-ом и 1-ом барах
 double OsMA_0=iOsMA(NULL,0,pF,pSl,pSig,1,0);
 double OsMA_1=iOsMA(NULL,0,pF,pSl,pSig,1,1);
 double Sto_0=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_MAIN,0);
 double Sto_1=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_MAIN,1);
 
 //-------------открытие позиции Buy покупка----------------- 

 if(
   (Sto_0>Sto_1)&&
   (Sto_0< 20)&&
   (OsMA_0>OsMA_1)&&
   (OsMA_0<-P)
   ) //торговое условие на покупку
 if( CheckOrders (OP_SELL)) 
      {
       if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber)
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
       }
    //-------------------Конец блока покупки -------------------
    

and it gave me an error on the blank space

'\end_of_program' - unbalanced left parenthesis C:\Program Files\MetaTrader - Alpari\experts\expertOsMA_Stochastic.mq4 (104, 1)

this space is marked *

 
* //-------------открытие позиции Buy покупка----------------- 

tried removing,tried adding.... tried everything, nothing.

Can anyone give me a hint? -)))))))))))))))))

And don't mean to intrude, first question on page 832....

 
chief2000:

In general, the CCI jumps so wildly that it is better to check it after the bar ends and a new one opens.

And if it is strongly important to the current one, then at each crossing we should memorize the time of opening of a candle in the global variable and then check if the time is different (if it is, the order opens) or it is the same (=> no order opens).

CCI was just an example. It will be replaced by another indicator. As for the code, maybe something similar to this:

static int prevtime = 0;

int init() {
   prevtime = Time[0];
   return(0);
}

int start() {

   if (! IsTradeAllowed()) {
      return(0);
   }

   if (Time[0] == prevtime) {
      return(0);
   }
   prevtime = Time[0];

   int ticket = -1;
   int total = OrdersTotal();
   for (int i = total - 1; i >= 0; i--) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == magic)) {
         int prevticket = OrderTicket();
         if (OrderType() == OP_BUY) {
 

igrok2008, you need the whole code, this error means there is a problem with the brackets in some part, try this first


 if( CheckOrders (OP_SELL)) 
      {
       if(OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber)<0)
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
      }
 
Techno:

igrok2008, you need the whole code, this error means there is a problem with the brackets in some part, try this first


Oddly enough it worked. Had to change the shell position too!!!

Here's the whole code

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

//---- input parameters
extern int       pF=8;
extern int       pSl=34;
extern int       pSig=13;
extern double    P=0.0007;
extern int       pK=21;
extern int       pD=5;
extern int       SL=8;
extern double    Lots=0.1;
extern int       MagicNumber=123456;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
  
bool CheckOrders(int Type)
{
 bool Result=True;
 for(int i=0;i<OrdersTotal();i++)
  if(OrderSelect(i,SELECT_BY_POS))
   if(OrderMagicNumber()==MagicNumber && OrderSymbol() == Symbol())
      if(OrderType()==Type)
        {
         if(Type==OP_BUY)
           if(!OrderClose(OrderTicket(),OrderLots(),Bid,0))
             Result=False;
         if(Type==OP_SELL)
           if(!OrderClose(OrderTicket(),OrderLots(),Ask,0))
             Result=False;
         } 
        else Result=False;
 return(Result); 
}
  
  
  
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//Рассчитываем значения OsMA и Stochastic на 0-ом и 1-ом барах
 double OsMA_0=iOsMA(NULL,0,pF,pSl,pSig,1,0);
 double OsMA_1=iOsMA(NULL,0,pF,pSl,pSig,1,1);
 double Sto_0=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_MAIN,0);
 double Sto_1=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_MAIN,1);
 
//-------------открытие позиции Buy покупка----------------- 

 if(
   (Sto_0>Sto_1)&&
   (Sto_0< 20)&&
   (OsMA_0>OsMA_1)&&
   (OsMA_0<-P)) //торговое условие на покупку
 if( CheckOrders (OP_SELL)) 
      {
       if(OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber)<0)
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
      }
    //-------------------Конец блока покупки -------------------
    
    //-------------Открытие позиции Sell продажа----------------  
    
    if(true        &&
      (Sto_0<Sto_1)&&
      (Sto_0>80)&&
      (OsMA_0<OsMA_1)&&
      (OsMA_0>P))//торговое условие на продажу
     if( CheckOrders (OP_BUY)) 
      {
       if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, NULL, MagicNumber)>0)
         Print("Не открыт ордер Sell. Ошибка №", GetLastError()); 
       }

//-----------------конец блока продажи ----------------------
   return(0);
  }
//+------------------------------------------------------------------+
 
and a quick question for you, please???????
 

igrok2008:

I had to change the shell position too!!!

and one more question can you???????
and there you need to remove the exclamation mark in front of the ordersend function and put no more than 0, and as in the first one less than 0.
 

got it!!!!

but here's a question.....

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

//---- input parameters
extern int       pK=21;
extern int       pD=5;
extern int       SL=8;
extern double    Lots=0.1;
extern int       MagicNumber=123456;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
  
bool CheckOrders(int Type)
{
 bool Result=True;
 for(int i=0;i<OrdersTotal();i++)
  if(OrderSelect(i,SELECT_BY_POS))
   if(OrderMagicNumber()==MagicNumber && OrderSymbol() == Symbol())
      if(OrderType()==Type)
        {
         if(Type==OP_BUY)
           if(!OrderClose(OrderTicket(),OrderLots(),Bid,0))
             Result=False;
         if(Type==OP_SELL)
           if(!OrderClose(OrderTicket(),OrderLots(),Ask,0))
             Result=False;
         } 
        else Result=False;
 return(Result); 
}
  
  
  
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//Рассчитываем значения Stochastic b его сигнальную на 0-ом и 1-ом барах
 double Sto_0=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_MAIN,0);
 double Sto_1=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_MAIN,1);
 double Sig_0=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_SIGNAL,0);
 double Sig_1=iStochastic(NULL,0,pK,pD,SL,1,1,MODE_SIGNAL,1);
   
   //-------------открытие позиции Buy покупка----------------- 
 if((((Sto_0> Sig_0&&Sto_1>Sig_1)&&(Sig_0< 20)||(Sto_0>=80)))) //торговое условие на покупку
 if(CheckOrders(OP_SELL)) 
      {
       if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, NULL, MagicNumber))
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
       }
    //-------------------Конец блока покупки -------------------
    
    //-------------Открытие позиции Sell продажа----------------  
    
    if((((Sto_0< Sig_0&&Sto_1<Sig_1)&&(Sig_0> 80)||(Sto_0<=20))))//торговое условие на продажу
     if(CheckOrders(OP_BUY)) 
      {
       if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, NULL, MagicNumber))
         Print("Не открыт ордер Sell. Ошибка №", GetLastError()); 
       }

//-----------------конец блока продажи ----------------------
   return(0);
  }
//+------------------------------------------------------------------+

my expert is simple (for training), but I can't use it :-((((

The essence - the stoch goes up from below, crosses the line 20, put an order BAY, the price has gone further...... has reached the crossing of the line 80 order is closed.

The price continues to bounce as it wants..... on the Sell condition vice versa, i.e., buys and sells BUT so that between opposite orders would be a time gap....

It's something like this.........

Thanks in advance