Errors, bugs, questions - page 757

 
joo:

If you run this code, the terminal gives an error Invalid EX5 file:

Thank you, we'll look into it.

 

Fibonacci arcs

Level modification causes a compile-time error

   string       ObjFA_nm;
   ObjectCreate(
                0,ObjFA_nm="FIBOARC_object"+"_"+IntegerToString(MathRand()),
                OBJ_FIBOARC,0,
                TimeLocal(),1.25,
                TimeLocal(),1.28
                );
   ObjectSetInteger(0,ObjFA_nm,OBJPROP_LEVELVALUE,1,1);
'ObjectSetInteger' - no one of the overloads can be applied to the function call        sFiboArcsAvtoV1.SD.mq5  22      4
 
Silent:

Fibonacci arcs

Level modification causes a compile-time error

and you are sure that
OBJPROP_LEVELVALUE
this is an Integer property?
 
sergeev:
and are you sure that
it's an Integer property?
I was sure :) thank you!
 
Dear Gentlemen Developers. Is it a joke that the time of the MetaQuotes-Demo server is running a little ahead of the true time every day?
 

In tester Version:5.00 Build 655 (06.Jun.2012) No stoploss sell modifications, no errors shown. On buy, no problems all works

#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\PositionInfo.mqh>
//+------------------------------------------------------------------+
input double   Lot         = 0.01; 
input int      Magic       = 77;
input int      Deviation   = 3;
//+------------------------------------------------------------------+
double ask,bid,stoploss,SL,pos_op_price;
//+------------------------------------------------------------------+
CTrade        mytrade;
CSymbolInfo   mysymbol;
CPositionInfo myposition;
//+------------------------------------------------------------------+
void OnTick()
{ 
    mysymbol.Name(_Symbol);
    mytrade.SetDeviationInPoints(Deviation);
    mytrade.SetExpertMagicNumber(Magic);
    mysymbol.RefreshRates();
    bid      =  NormalizeDouble(mysymbol.Bid(),_Digits);
    ask      =  NormalizeDouble(mysymbol.Ask(),_Digits);
    stoploss =  NormalizeDouble(myposition.StopLoss(),_Digits); 
    SL       =  NormalizeDouble(mysymbol.StopsLevel()*_Point*3,_Digits);  // Три минимальных стопа???
    pos_op_price = NormalizeDouble(myposition.PriceOpen(),_Digits);
//+------------------------------------------------------------------+   
   if (myposition.Select(_Symbol)==false) 
     {
       mytrade.Sell(Lot,NULL,bid,ask + SL,0,"Sell");
       if(mytrade.ResultRetcode()==10009 || mytrade.ResultRetcode()==10008)
        {
         Alert("Position Sell успешно помещен, тикет ордера #:",mytrade.ResultDeal(),"!!");
        }
      else
        {
         Alert("Запрос на установку Position Sell не выполнен - код ошибки:",mytrade.ResultRetcode(),
         "сообщение об ошибке - ",mytrade.ResultRetcodeDescription());
         return;
        }
     }
//+------------------------------------------------------------------+
   if (myposition.Select(_Symbol))
     {
       if (myposition.Type() == POSITION_TYPE_SELL)
         {          
            if (ask + SL < stoploss)
            mytrade.PositionModify(_Symbol,NormalizeDouble(ask + SL,_Digits),0);
            if(mytrade.ResultRetcode()==10009 || mytrade.ResultRetcode()==10008)
              {
               Alert("Stoploss Position Sell успешно помещен :",stoploss);
              }
            else
              {
               Alert("Запрос на установку Stoploss Position Sell не выполнен - код ошибки:",mytrade.ResultRetcode(),
               "сообщение об ошибке - ",mytrade.ResultRetcodeDescription());
               return;
              }
         }      
      } 
//+------------------------------------------------------------------+
Comment("ask   ",ask,"\n","bid   ",bid,"\n","SL   ",SL,"\n","stoploss   ",stoploss,
"\n","pos_op_price   ",pos_op_price,"\n","slsell   ",NormalizeDouble(ask + SL,_Digits));    
//+------------------------------------------------------------------+
}
//+------------------------------------------------------------------+

bild

 
 
alexvd:

Which server?

MetaQuotes-Demo access.metatrader5.com:443
 
pako:

In tester Version:5.00 Build 655 (06.Jun.2012) No stoploss sell modifications, no errors shown. On buy, no problem all works

Try the following edits

if (myposition.PositionType() == POSITION_TYPE_SELL)
 
alexvd:

Try these edits

Yes it works, thank you very much.
Reason: