Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1379

 
MakarFX:
Do you want help or an adviser?

I won't be cheeky. I'm asking for help with implementation. Examples, links, articles, ... I'll try to write a ready-made version myself.

 
Vitaly Muzichenko:

Thank you

 
Forallf:

I won't be cheeky. I'm asking for help with implementation. Examples, links, articles, ... I'll try to write a ready-made version myself.

Start with this one.

   if(signal==up&&OrdersTotal()==0)//если сигнал на покупку
     {
      if(OrderSend(Symbol(),OP_BUYSTOP,Lots_UP,open_price_up,slippage,stop_loss_up,take_profit,NULL,magik_01,0,Color_up))
        {Print("Ордер на покупку уснановлен");}
     }
   if(signal==dn&&OrdersTotal()==0)//если сигнал на продажу
     {
      if(OrderSend(Symbol(),OP_SELLSTOP,Lots_DN,open_price_dn,slippage,stop_loss_dn,take_profit,NULL,magik_01,0,Color_dn))
        {Print("Ордер на продажу уснановлен");}
     }
   for(int pos=0;pos<OrdersTotal();pos++)
     {
      if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderType()==OP_BUY)
           {open_price_dn=OrderStopLoss();stop_loss_dn=OrderOpenPrice();
            if(OrderSend(Symbol(),OP_SELLSTOP,Lots_DN,open_price_dn,slippage,stop_loss_dn,take_profit,NULL,magik_01,0,Color_dn))
              {Print("Ордер на продажу уснановлен");}
           }
         if(OrderType()==OP_SELL)
           {open_price_up=OrderStopLoss();stop_loss_up=OrderOpenPrice();
            if(OrderSend(Symbol(),OP_BUYSTOP,Lots_UP,open_price_up,slippage,stop_loss_up,take_profit,NULL,magik_01,0,Color_up))
              {Print("Ордер на покупку уснановлен");}
           }
        }
      }
 
MakarFX:

This is where you start

Thank you. I assembled Frankenstein.
 
The question now is how to split the orders. If the orders are placed every hour, can the Magic Number be linked to the time of the bar?
 
Forallf:
The question now is how to split the orders. If the orders are placed every hour, can we attach the Magic Number to the time of the bar?
And not only to the order type or position type, but also to everything we want to get from the Magic Number. Many things can be coded. The name of owl, by the way, is also useful.
 
Forallf:
The question now is how to split the orders. If the orders are placed every hour, can the Magic Number be linked to the time of the bar?
if (TimeHour==1)magik_01=01;
if (TimeHour==2)magik_01=02;
etc.
 
MakarFX:

Now they use "input" instead of "extern".

You need to move your "extern variables" to the SIGNALS_INDIKATOR.mqh library, too.

I have another question. The variables I use in iCast can be moved to a target file and they can be deleted from the EA file, right?
 
DanilaMactep:
I then have another question - the variables that I use in iCastom are transferred to a plug-in file, and they can be deleted from the EA file - correct?
Yes
 
Hello! This may be stupid question, but how to draw over a stupid one huge black rectangle (close the entire chart) and write over it the inscription, like a logo. So far, out of the situation that I set all the elements of the stupid black colour chart and all (make it visible), and then write the inscription on top, but apparently the properties apply to other charts (but not accurately) and maybe that's not the case. Another option is one huge button, but the text in it is anchored at the bottom in the middle (I'd like it to be centered), how to change that - I don't know yet, and whether it's possible. I wanted to try using obj_rectangle_label, but the text is not written over it.
And yes, I forgot to say, everything is written in mql4
Reason: