[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 514

 
sss2019:

Here is another point: this order opens on some fractal, on the fractal. If the last order is found, is there any way to find out what fractal it opened in?

Find the bar at which the order was opened ( iBarShift(Symbol(), Period(), OrderOpenTime ()) )


On this bar, there is that fractal.

 
Reshetov:


I've set pips from the current price as 150 or 300, but it still won't work.
 
a.DarkAngel:

Hello!

Why does it only delete BUYSTOP but not SELLLIMIT? Although I have two orders open!

if (Hour()==19 && Minute()==00 && Кризис_1989==true)
            {
             for( int i=1; i<=OrdersTotal(); i++)          
      {
             if(OrderSelect(i-1,SELECT_BY_POS)==true) 
               {                                       
                if(OrderType()==OP_SELLLIMIT  && OrderSymbol()==Symbol())
                  {
                  OrderDelete(OrderTicket()); 
                  }//if
  
                if(OrderType()==OP_BUYSTOP && OrderSymbol()==Symbol())
                  {
                  OrderDelete(OrderTicket()); 
                  }//if
               }//if
            return(0);
            }
          }   
if (Hour()==19 && Minute()==00 && Кризис_1989==true) {
   for (int i=OrdersTotal()-1; i>=0; i--) {
      if (OrderSelect(i, SELECT_BY_POS)) {                                       
         if (OrderSymbol()!=Symbol())     continue;
         if (OrderType()==OP_SELLLIMIT)   OrderDelete(OrderTicket()); 
         if (OrderType()==OP_BUYSTOP)     OrderDelete(OrderTicket()); 
         }
      }
   }    

It's like a child's picture: Find ten differences... :)

When you delete orders, you have to do the loop from the end of the list. And you have return(0) inside the loop.

 
Andreyu:

Hello all!

I can't place an order if I specify a stop loss:


Does the broker allow SL to be set when opening an order?

And where is NormalizeDouble?

 

Greetings, guys, please.
I've been struggling with this for over a week. Can someone who knows better draw the right code?

This Expert Advisor opens a deal in the same direction, where the stop-loss was. But with lot twice more, by this expression: lot=lot*koef;

I need it to multiply all losing trades with given number of times. I.e. 0.01,0.01,0.01; 0.02,0.02,0.02; 0.04,0.04,0.04; 0.08,0.08,0.08...... and only.

How many different counters have been re-done... NETTO

Haven't delved into the language in 4 years until I've had a breakdown. Here's all the code to think about...

Thank you very much!!!

int X=0;
extern double       lot=0.01;
extern double       koef=1.5;
extern int       SL=10;
extern int       TP=10;
double dl;
double a;
int init()
 {
 a=lot;
  return(0);
 }
int deinit()
 {
  return(0);
 }
int start()
{   

if(OrdersTotal() == 0 && X==1)
             { 
             if (Close[0]>dl){lot=a;}              X=0;
             }             
if(OrdersTotal() == 0 && X==2)
             { 
             if (Close[0]<dl){lot=a;}
             X=0;
             }     
if (OrdersTotal() == 0 && Close[1]>Open[1]) 
                          {
        dl=Close[0];
OrderSend(Symbol(),OP_BUY,lot,Ask,3,Ask-SL*0.0001,Ask+TP*0.0001,"",14774,0,Blue); 

  lot=lot*koef;
                           X=1;            
                          }
   if(OrdersTotal() == 0 && && Close[1]<Open[1]) 
                          {
    dl=Close[0];
OrderSend(Symbol(),OP_SELL,lot,Bid,3,Bid+SL*0.0001,Bid-TP*0.0001,"",14774,0,Red); 
                           lot=lot*koef;
                           X=2;
                          } 
   return(0);
}
 
Andreyu:

I set pips of 150 and 300 from the current price and it still does not work.

Most likely you have an account with one of those brokers that forbids setting orders with take and loss.

The broker's support department is not allowed to discuss brokers on this forum.

 
edyuson:

Greetings, guys, please.
I've been struggling with this for over a week. Can someone who knows better draw the right code?

This Expert Advisor opens a deal in the same direction, where was the stop loss. But with lot twice more, by this expression: lot=lot*koef;

I need it to multiply all losing trades with given number of times. I.e. 0.01,0.01,0.01; 0.02,0.02,0.02; 0.04,0.04,0.04; 0.08,0.08,0.08...... and only.

How many different counters have been re-done... NETTO

Haven't delved into the language in 4 years until I've had a breakdown. Here's all the code to think about...

Thank you very much!!!

struggling with the same topic - where in the code is the previous loss trade recorded
 **** Close[1]>Open[1] // это не лосс!!!
 
YOUNGA:
struggling with the same topic - where in the code is the previous loss trade recorded
**** Close[1]>Open[1] // это не лосс!!!
 // это свечи закрытия>открытия
if(OrdersTotal() == 0 && X==1)
             { 
             if (Close[0]>dl){lot=a;} 
             X=0;
             }             
if(OrdersTotal() == 0 && X==2)
             { 
             if (Close[0]<dl){lot=a;}
             X=0;
             }     
 // тут регулеровка


 
edyuson:

you're comparing the sloses of different candles, what does that have to do with the loss?
 
YOUNGA:
you're comparing the cloze of different candlesticks what does this have to do with the loss?

I'm not blaming you, it's not my puzzle. I just found a similar algorithm that I need and am trying to finish it, just like I need it. https://www.mql5.com/ru/code/9927 What I took out, what I left in.

 if(OrdersTotal() == 0 && Close[1]<Open[1])                                        //Если ордеров 0 и закрытие свечи 1<Открытие свечи 1 
  dl=Close[0];                                                                     //эт не дошло толком                 
 OrderSend(Symbol(),OP_SELL,lot,Bid,3,Bid+SL*0.0001,Bid-TP*0.0001,"",14774,0,Red)  //тело открывает на продажу
      
         

i want it 0.01,0.01,0.01; 0.02,0.02,0.02; 0.04,0.04,0.04; 0.08,0.08,0.08......

Reason: