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

 
fmillion:
'' - unexpected end of program G:\work\MetaTrader Group\experts\Balista.mq4 (576, 1)

Poke with mouse - it moves to the place with comments ((... What should I do ?


Looking for a missing bracket.

 
fmillion:
'' - unexpected end of program G:\work\MetaTrader Group\experts\Balista.mq4 (576, 1)

Poke with mouse - it moves to the place with comments ((... What to do ?


The easiest way to find the error is the magic button in MetaEditor "Undo". And after another undo, try to compile code again.
 
Good day! Tell me. Let's say I'm going to use
double iMA(     string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

In the help it says timeframe - Period. Can be one of the periods of a graph. 0 means the period of the current graph.

Can it, or is it definitely the period of the graph? But what if I put in 20 instead of 15? Is it better to use a number or is PERIOD_M15 better?

Ok, I put 0 there and do not bother.

 

Good day everyone. I would be very grateful if someone could insert a sound into this indicator.

I.e. when there is a crossing of .... and of course the sound should only be made once at the close of the candle on which this crossing has occurred.

Thanks in advance for your help.

Files:
 
Dimka-novitsek:
Good day! Tell me. Let's say I'm going to use

In the help it says timeframe - Period. Can be one of the periods of a graph. 0 means the period of the current graph.

Can it, or is it definitely the period of the graph? But what if I put in 20 instead of 15? Is it better to use a number or is PERIOD_M15 better?

Ok, I put 0 there and do not bother.

The period is set in minutes. For example, 60 is an hour, 240 is 4 hours... etc, 5 is M5.
 

I haven't foundKimIV's feature to return the drawdown/profit amount from the last closed order.

The idea is simple: you need to track how much in deposit currency the Profit or Drawdown was in the last closed order.

 
fmillion:

I haven't foundKimIV's feature to return the drawdown/profit amount from the last closed order.

The idea is simple: you need to track how much in deposit currency the Profit or Drawdown was in the last closed order.

This design works for me:

//---Поиск крайнего отработавшего ордера для открытия очередной позиции ---   
   for (orderIndex = (OrdersHistoryTotal() - 1); orderIndex >= 0; orderIndex--)
   {   
      if (!OrderSelect(orderIndex, SELECT_BY_POS, MODE_HISTORY)) {Print("Ошибка при доступе к исторической базе (",GetLastError(),")");continue;}   
      if ((OrderSymbol() != Symbol()) || (OrderMagicNumber() != MagicNumber))  continue;              
   //------------------------- Принимаем в расчет только ордер, закрытый cамым крайним -----------------------
      if (time<OrderCloseTime())     //(сравниваем его с хранящимся в пероеменной time) 
        {
         time=OrderCloseTime();     //если время закрытия ордера больше - ложим его в переменную     
         int lastType = OrderType();
         double lastLots = OrderLots();
         double lastProfit = OrderProfit() + OrderSwap();
         
         // Анализ только что закрывшегося ордера      
         if (lastProfit >= 0.0)
         {
...
 
Roman.:

I have such a design that works:

and what is the time variable at the beginning of the loop equal to ?
 
fmillion:

I haven't foundKimIV's feature to return the drawdown/profit amount from the last closed order.

The idea is simple: you need to track how much in deposit currency the Profit or Drawdown was in the last closed order.

The algorithm is as follows: look for ANY function that returns ANYTHING about the last closed order. Get the Ticket of that last closed order. When the loop is over, you select an order by the obtained Ticket and calculate its profit (if it is important, we should not forget to consider the swap and commission when calculating it):

    Profit = OrderProfit() + OrderSwap() + OrderCommission();
 
Zhunko:
Run it and take a look. Quite a useful "kit".

I can see that the "dog" and the spaces between it are used to display a number. But why does this happen? Is it something not from mql programming? Is there such a thing in C?

I don't really understand why it happens. And I'm not quite sure what it outputs either. I see Fibo numbers at some levels through the "dog", and at some levels something else?

Can you explain the reason of their appearance? I have become very curious. But I opened it for the second day and did not understand it.

I will duplicate the script code to avoid searching for it in the history:

//+------------------------------------------------------------------+
//|                              Brooky_FibIt_Retracement_Script.mq4 |
//|                        Copyright 2012, www.Brooky_Indicators.com |
//|                                        www.Brooky_Indicators.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, www.Brooky_Indicators.com"
#property link      "www.Brooky_Indicators.com"
#property show_confirm  
#property show_inputs
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+

extern int       FibOnChartNum =1;

extern color     Fib_Cbar_Color = Red;
extern int       Fib_Cbar_Size=1;
extern int       Fib_Cbar_Style=2;

extern color     Fib_Level_Color = Gray;
extern int       Fib_Level_Size=1;
extern int       Fib_Level_Style=2;

extern double     Fib_Level_1 = 0;
extern double     Fib_Level_2 = 0.236;
extern double     Fib_Level_3 = 0.382;
extern double     Fib_Level_4 = 0.5;
extern double     Fib_Level_5 = 0.618;
extern double     Fib_Level_6 = 0.764;
extern double     Fib_Level_7 = 1;

string Xtra_txtFib_Level_1  = "Extreme ";
string Xtra_txtFib_Level_2  = "Break OUT ";
string Xtra_txtFib_Level_3  = "Break IN ";
string Xtra_txtFib_Level_4  = "Centre ";
string Xtra_txtFib_Level_5  = "Break IN ";
string Xtra_txtFib_Level_6  = "Break OUT ";
string Xtra_txtFib_Level_7  = "Extreme ";


string txtFib_Level_1  = "";
string txtFib_Level_2  = "";
string txtFib_Level_3  = "";
string txtFib_Level_4  = "";
string txtFib_Level_5  = "";
string txtFib_Level_6  = "";
string txtFib_Level_7  = "";


string FibPrice = " @ %$";
string FibPrice1 = " ";
string FibName = "";

int start()
  {

//----
      txtFib_Level_1 = StringConcatenate(Xtra_txtFib_Level_1,DoubleToStr(Fib_Level_1,3),FibPrice1);
      txtFib_Level_2 = StringConcatenate(Xtra_txtFib_Level_2,DoubleToStr(Fib_Level_2,3),FibPrice);
      txtFib_Level_3 = StringConcatenate(Xtra_txtFib_Level_3,DoubleToStr(Fib_Level_3,3),FibPrice1);
      txtFib_Level_4 = StringConcatenate(Xtra_txtFib_Level_4,DoubleToStr(Fib_Level_4,3),FibPrice);
      txtFib_Level_5 = StringConcatenate(Xtra_txtFib_Level_5,DoubleToStr(Fib_Level_5,3),FibPrice1);
      txtFib_Level_6 = StringConcatenate(Xtra_txtFib_Level_6,DoubleToStr(Fib_Level_6,3),FibPrice);
      txtFib_Level_7 = StringConcatenate(Xtra_txtFib_Level_7,DoubleToStr(Fib_Level_7,3),FibPrice);
      
      
      
      FibName = "Brooky_FibR_"+FibOnChartNum;
      ObjectDelete(FibName);
      
      ObjectCreate(FibName,OBJ_FIBO,0,Time[21],High[24],Time[1],Low[1]);
      
      ObjectSet(FibName, OBJPROP_COLOR,Fib_Cbar_Color);
      ObjectSet(FibName, OBJPROP_WIDTH ,Fib_Cbar_Size);
      ObjectSet(FibName, OBJPROP_STYLE ,Fib_Cbar_Style);
      
      ObjectSet(FibName, OBJPROP_RAY,True);
       
      ObjectSet(FibName, OBJPROP_LEVELSTYLE,Fib_Level_Style);
      ObjectSet(FibName, OBJPROP_LEVELCOLOR,Fib_Level_Color);      
      ObjectSet(FibName, OBJPROP_LEVELWIDTH,Fib_Level_Size);  
       
          
      ObjectSet(FibName, OBJPROP_FIBOLEVELS,7);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+0,Fib_Level_1);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+1,Fib_Level_2);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+2,Fib_Level_3);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+3,Fib_Level_4);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+4,Fib_Level_5);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+5,Fib_Level_6);
      ObjectSet(FibName, OBJPROP_FIRSTLEVEL+6,Fib_Level_7);
      

     
      ObjectSetFiboDescription(FibName,0,txtFib_Level_1);
      ObjectSetFiboDescription(FibName,1,txtFib_Level_2);
      ObjectSetFiboDescription(FibName,2,txtFib_Level_3);
      ObjectSetFiboDescription(FibName,3,txtFib_Level_4);
      ObjectSetFiboDescription(FibName,4,txtFib_Level_5);
      ObjectSetFiboDescription(FibName,5,txtFib_Level_6);
      ObjectSetFiboDescription(FibName,6,txtFib_Level_7);      
      
//----
   return(0);
  }
//+------------------------------------------------------------------+
Reason: