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

 
tara:

Start - All programmes - Default programmes - Set mappings

This operation leads to a programme selection window. Specify a programme and it does not appear there.
 

Restoring the exe-associations didn't help - the kool-reader is an exe-reader. Thought it would help. Pity. Is there something else? They have a link to other file extensions there, but no fb2.
 
belous:

Guys...help who knows!!!!


The essence of the strategy: Entry by stochastic (5,14,3) exit also by stochastic but with another period (5,3,3). Here I do not understand how can zdelat an exit by stochastics, and not on the inverse signal?
I have a problem and I have no idea how it can be solved, I will try to explain.
So, there are 2 functions in the code I have laid out
...

Post the codes on the forum with the SRC. And there is nothing to shout about.


 
Hello.Who can suggest what the problem is with the advisor.When compiling gives the error that you have to put a parenthesis, I put-compile gives another that the parenthesis is put wrong.All my head is already broken.
Files:
 
artemka_1981:
Hello, may someone please advise me on what the problem is with my EA. I keep getting an error during compilation, I keep getting an error when I write a closing parenthesis and the compiler gives me another error when I write a closing parenthesis.

If you put a closing curly bracket at the end,

add lines like OrderMagicNumber() == )

and put a closing parenthesis in one of them, everything compiles

 
Can you tell me how to set order expiration correctly? I tried writing TimeCurrent()+60, the orders don't open. Generally, this parameter is allowed at the broker
 
sss2019:
Tell me how to correctly set order expiration? I tried to write TimeCurrent()+60, it does not open orders. Generally, this parameter is allowed at the broker

60 is 60 seconds, so you probably can't set it that low (I have a 10 minute limit, for example).

try TimeCurrent()+60*60*24 - one day

and see what error code comes back

 
ilunga:

If you put a closing curly bracket at the end,

add lines like OrderMagicNumber() == )

and put a closing parenthesis in one of them, everything compiles

Hello. I added a parenthesis and now the error is '\end_of_program' - unbalanced left parenthesis. Not clear ( put a closing parenthesis in one of them )
if(tim<iTime(Symbol(),PERIOD_D1,0)) return(1);
 return(0);
 }
 
 OrderMagicNumber()

 
artemka_1981:
Hello. I added a parenthesis and now the error is '\end_of_program' - unbalanced left parenthesis. Not clear ( put a closing parenthesis in one of them )

it compiles like this:

//+------------------------------------------------------------------+
//|                                                Open_Buy_Sell.mq4 |
//|                                                                  |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#define magic 999

#property link      "http://www.metaquotes.net"
extern double  _lots         = 0.01;
extern int     _takeProfit   = 1200;
extern int      maxpos       = 1;     // количество поз
extern bool    _trailingStop = true;
//+------------------------------------------------------------------+

int start()
  {
   double _slBuy=0.0,_slSell=0.0, _tpBuy=0.0, _tpSell=0.0, _opBuy=0.0, _opSell=0.0;

//if (iVolume(Symbol(),PERIOD_D1,0)>1) return;
//     if (Volume[0]>1) return;
     if (_trailingStop){ 
     _TrailingStop();
      }
   _opBuy=NormalizeDouble(iHigh(Symbol(),0,1), Digits);
   _slBuy=NormalizeDouble(iLow(Symbol(),PERIOD_D1,1), Digits);
   _tpBuy=NormalizeDouble(Ask+_takeProfit*Point, Digits);
      if ( _opBuy<Ask && CountPos(1)<maxpos)
       if(barOpen(OP_BUYSTOP)==1 ||barOpen(OP_BUY)==1 )
        OrderSend(Symbol(),OP_BUYSTOP,_lots,_opBuy,15,_slBuy,_tpBuy,"Open_Buy_Sell",0,Green);

   _opSell=NormalizeDouble(iLow(Symbol(),0,1), Digits);
   _slSell=NormalizeDouble(iHigh(Symbol(),PERIOD_D1,1), Digits);
   _tpSell=NormalizeDouble(Bid-_takeProfit*Point, Digits);
     if (_opSell>Bid && CountPos(0)<maxpos)
      if(barOpen(OP_SELLSTOP)==1 ||barOpen(OP_SELL)==1 )
       OrderSend(Symbol(),OP_SELLSTOP,_lots, _opSell,15,_slSell,_tpSell,"Open_Buy_Sell",0,Red);
//----
   return(0);
  }
//+------------------------------------------------------------------+  
 //Проверяем количесвто позиций.
   int CountPos(int type) 
{//Описание http://fxnow.ru/blog.php?user=Yuriy&blogentry_id=66

int i;
int col;
int count=0 ;
for(i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS)==true)
{
if(OrderType()==OP_BUYSTOP && OrderSymbol()==Symbol() && type==1 && OrderMagicNumber()== magic){count++;}
if(OrderType()==OP_SELLSTOP && OrderSymbol()==Symbol() && type==0 && OrderMagicNumber()== magic){count++;}
         }
       }   
return(count);
}
//+------------------------------------------------------------------+
void _TrailingStop(){
   int i;
   double _stopLossSellF=NormalizeDouble(iHigh(Symbol(),0,1), Digits),
          _stopLossBuyF=NormalizeDouble(iLow(Symbol(),0,1), Digits);
   if (OrdersTotal()>0){
      for (i=OrdersTotal()-1; i>=0; i--){
         if (OrderSelect(i, SELECT_BY_POS)){
            if (OrderSymbol()==Symbol() && OrderMagicNumber()==magic){
             
               if (OrderType()==OP_BUY && OrderOpenPrice() < _stopLossBuyF){
                  while (IsTradeContextBusy()) Sleep(1000);
                  RefreshRates();
                  OrderModify(OrderTicket(),OrderOpenPrice(),_stopLossBuyF,OrderTakeProfit(),OrderExpiration(),CLR_NONE);
               }
           
               if (OrderType()==OP_SELL && OrderOpenPrice() > _stopLossSellF && _stopLossSellF!=0.0){
                  while (IsTradeContextBusy()) Sleep(1000);
                  RefreshRates();
                  OrderModify(OrderTicket(),OrderOpenPrice(),_stopLossSellF,OrderTakeProfit(),OrderExpiration(),CLR_NONE);
               }
            }
         }
      }
   }
return;
}
int barOpen(int ty)
{
datetime tim=0;
 for(int i=0; i<=OrdersTotal(); i++)
    {  
       if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))continue;
       if(OrderSymbol() !=Symbol()|| OrderMagicNumber()!= magic|| OrderType()!=ty) continue; 
       if(tim<OrderOpenTime())        
          tim=OrderOpenTime();
   }
 for(i=0; i<=OrdersHistoryTotal(); i++)
    {  
       if (!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))continue;
       if(OrderSymbol() !=Symbol()|| OrderMagicNumber()!= magic|| OrderType()!=ty) continue; 
       if(tim<OrderOpenTime())        
          tim=OrderOpenTime();
   }
 
if(tim<iTime(Symbol(),PERIOD_D1,0)) return(1);
 return(0);
}
 

Can you tell me if I have two consecutive OrderSend commands for setting orders, do I need to place the IsTradeAllowed function between them?

or is it not necessary and the EA will pass from the first OrderSend call to the second one only after a successfully placed order?

If IsTradeAllowed is still required, what time delay should be set in the while loop?

Reason: