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

 
Alexander Mikryukov:

Good afternoon. Can you tell me what's wrong. I want to colour the Fibo levels in different colours, but they are not colored in any way. Below is the code of what I am doing. Thanks in advance for the help.

There is an answer on page 603.

Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4, помощь и обсуждение по алгоритмам и кодам
  • 2018.08.18
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
Alexey Viktorov:

Page 603 has the answer.

But why doesn't it work, since it seems to be spelled correctly!!!!

       ObjectCreate(0,"Fb_"+InpName,OBJ_FIBO,window,time1,price1,time2,price2);
            ObjectSet("Fb_"+InpName,OBJPROP_COLOR,clrDimGray);
            ObjectSet("Fb_"+InpName,OBJPROP_STYLE,STYLE_DOT);
            ObjectSet("Fb_"+InpName,OBJPROP_LEVELS,levels);
            ObjectSet("Fb_"+InpName,OBJPROP_RAY_RIGHT,false);
            for(int k=0;k<levels;k++)
              {
               //--- значение уровня
               ObjectSetDouble(0,"Fb_"+InpName,OBJPROP_LEVELVALUE,k,values[k]);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELCOLOR,k,colors[k]);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELSTYLE,k,styles[k]);
               ObjectSetFiboDescription("Fb_"+InpName,k,deskript[k]);
              }
 
Alexander Mikryukov:

But why doesn't it work, since it seems to be spelled correctly!!!!

There was a discussion here. Please don't repeat the same question all over the forum.

 
This doesn't work either (:
            ObjectCreate(0,"Fb_"+InpName,OBJ_FIBO,window,time1,price1,time2,price2);
            ObjectSet("Fb_"+InpName,OBJPROP_COLOR,clrDimGray);
            ObjectSet("Fb_"+InpName,OBJPROP_STYLE,STYLE_DOT);
            ObjectSet("Fb_"+InpName,OBJPROP_LEVELS,6);
            ObjectSet("Fb_"+InpName,OBJPROP_RAY_RIGHT,false);
           
               ObjectSetDouble(0,"Fb_"+InpName,OBJPROP_LEVELVALUE,0,1);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELCOLOR,0,clrDarkGray);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELSTYLE,0,STYLE_DOT);
               ObjectSetFiboDescription("Fb_"+InpName,0,"100");

               ObjectSetDouble(0,"Fb_"+InpName,OBJPROP_LEVELVALUE,1,0.236);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELCOLOR,1,clrGreen);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELSTYLE,1,STYLE_DOT);
               ObjectSetFiboDescription("Fb_"+InpName,1,"23.6 [%$]");

               ObjectSetDouble(0,"Fb_"+InpName,OBJPROP_LEVELVALUE,2,0.382);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELCOLOR,2,clrRed);
               ObjectSetInteger(0,"Fb_"+InpName,OBJPROP_LEVELSTYLE,2,STYLE_DOT);
               ObjectSetFiboDescription("Fb_"+InpName,2,"38.2 [%$]");
 
//+-------------------------------------------------------------------------------------+
//| Savin.mq4 |
//| Copyright 2014, Gnatenko Global Group, VADIMBETMAN Inc.
//| http://vadimbetman.ucoz.com |
//+-------------------------------------------------------------------------------------+
#property copyright "Copyright 2014, Gnatenko Global Group, VADIMBETMAN Inc.
#property link "http://vadimbetman.ucoz.com"
//+-------------------------------------------------------------------------------------+
//extern int TakeProfit = 20;
extern int StopLoss = 100;
//+-------------------------------------------------------------------------------------+
//| expert initialization function |
//+-------------------------------------------------------------------------------------+
void init(){
//----
//----
}
//+-------------------------------------------------------------------------------------+
//| expert deinitialisation function |
//+-------------------------------------------------------------------------------------+
void deinit(){
//----
//----
}
//+-------------------------------------------------------------------------------------+
//| expert start function |
//+-------------------------------------------------------------------------------------+
void start(){
//----
double Take1 = Ask+20 *Point;
double Take2 = Ask+0 *Point;
double Take3 = Ask-20 *Point;
double Take4 = Ask-40 *Point;
double Take5 = Ask-60 *Point;
double Stop = Bid-StopLoss *Point;
if(OrdersTotal()==0){
OrderSend(Symbol(),0,0.01,Ask,30,Stop,Take1,",0,0,CLR_NONE);
OrderSend(Symbol(),2,0.02,Ask-20*Point,30,Stop,Take2,",0,0,CLR_NONE);
OrderSend(Symbol(),2,0.04,Ask-40*Point,30,Stop,Take3,",0,0,CLR_NONE);
OrderSend(Symbol(),2,0.08,Ask-60*Point,30,Stop,Take4,",0,0,CLR_NONE);
OrderSend(Symbol(),2,0.16,Ask-80*Point,30,Stop,Take5,"",0,0,CLR_NONE);
}
}
//----
//+-------------------------------------------------------------------------------------+

//+-------------------------------------------------------------------------------------+

Can you add

when any order was closed on take profit, all pending and urgent orders should be closed.

 

SanNneK:

...

Can you add

When any order was closed on Take Profit, all pending and emergency orders should be closed.

This is a help for solving problems when you can not do it yourself, not an altruistic society.

If you need someone to write it for you, you're welcome to do it here.

 
@Artyom Trishkin I need to write a code when any order reaches take profit, all other orders pending and usual closed, I do not need other advisors
 
SanNneK:
@Artyom Trishkin I need to write code when any order reaches take profit, all other orders pending and usual closed, I do not need other advisors.

Start writing code. What you can't do, ask, show me in your code and they will help you.

 
Good afternoon Guys, please advise where to find information. The task is to determine the price range and open orders on its penetration. There are 2 methods to determine this range. The first way is to determine the minimum and maximum at the specified time intervals. The second way is to look for the first differently directed fractals in a specified time frame and this range is traded. I cannot find similar algorithms to fit my needs. (Please, help me...))
 

I wrote code that when take profit of the first buy order triggers, all pending orders are closed, but it does not work, highlighted in blue what does not work

void start(){

//----

double Take1 = Ask+20 *Point;

double Take2 = Ask+0 *Point;

double Take3 = Ask-20 *Point;

double Take4 = Ask-40 *Point;

double Take5 = Ask-60 *Point;

double Stop = Bid-StopLoss *Point;

if(OrdersTotal()==0){

OrderSend(Symbol(),0,0.01,Ask,30,Stop,Take1, "sdsdasdadwadawd",0,0,CLR_NONE);

OrderSend(Symbol(),2,0.02,Ask-20*Point,30,Stop,Take2, "awda",0,0,CLR_NONE);

OrderSend(Symbol(),2,0.04,Ask-40*Point,30,Stop,Take3, "awdawd",0,0,CLR_NONE);

OrderSend(Symbol(),2,0.08,Ask-60*Point,30,Stop,Take4, "awdawd",0,0,CLR_NONE);

OrderSend(Symbol(),2,0.16,Ask-80*Point,30,Stop,Take5, "awdawdawda",0,0,CLR_NONE);

}


if(OP_BUY==Take1)

{

OrderDelete(2);

}

if(OP_BUY==Take1)

{

OrderDelete(3);

}

if(OP_BUY==Take1)

{

OrderDelete(4);

}

if(OP_BUY==Take1)

{

OrderDelete(5);

return(0);

}


}