[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 803

 
Andrei01:
Is there any way to know the price limits on the vertical scale of the chart to calculate the scale (not the price of the instrument, found by F8)?

double WindowPriceMin( int index=0)
double WindowPriceMax( int index=0)
 
Top2n:
Hello, I am running the Expert Advisor in the Strategy Tester but it is not opening a position. In the magazine says EURUSD,M5: OrderSend error 131. I don't know how many times I've seen this EA open and it did not open one position anymore. Please advise if someone has had such problems. Thanks in advance


Maybe you don't have normalized lot, try to bring it back to normal by using:
double NormalizeDouble( double value, int digits)
 
zhuki:
You probably don't have a normalized lot, normalize it with:
double NormalizeDouble( double value, int digits)
Actually, if memory serves me correctly, he has a ready function for lot normalization...
Taking into account all possible DT limitations...
Except if he's not using it... then - Ouch... :)
 
zhuki:

double WindowPriceMin( int index=0)
double WindowPriceMax( int index=0)
Thank you. Is there any way to change this programmatically?
 

Hello forum people.

My grandparents told me it's Honeymoon Day. Happy holiday to all.

And me with my... Drknn says it's possible to process indicator readings.

Is it possible to sum A / D for a given period and the same amount OBV, and then divide them between themselves (OBV in the numerator)

The denominator is A/D + coefficient with output to the settings.

Zero in the middle, borders are floating.

Sum-NO TOTAL. Each movement by absolute value.

And I'll give you a reversal on the Jew

 
Konichiua to all! How do I make my EA open three orders with different takeovers and only once on a candlestick in a buy or sell condition. Arigato in advance!
 
Maniac:
Konichiua to all! How do I make my EA open three orders with different takeovers and only once on a candlestick in a buy or sell condition. Arigato in advance!
How do I make 3 Send orders with different Take Points or loop this function up to 3 (for or while), at each iteration a different Take Point
 
sanyooooook:
Make a 3 order send with different targets or loop this function up to 3 (for or while), at each iteration different target


Make 3 Send orders with different points - opens the first order three times :(

loop this function to 3(for or while), each iteration has a different take - opens a bunch of first orders :(

If not hard to show how to do it?

 
Maniac:


Make a 3 order send with different targets - opens the first order three times :(

loop this function to 3(for or while), each iteration has a different take - opens a bunch of first orders :(

If not too complicated, can you show me how to do it?

Do you keep count of the open orders?
 
sanyooooook:
Are the open orders counted?
extern double TakeProfit = 35;
extern double StopLoss   = 25;
extern double Lots       = 0.1;

int NumberOfBarOpenLastPos(string sym="", int tf=0, int op=-1, int mn=-1) {
  datetime oot;
  int      i, k=OrdersTotal();
 
  if (sym=="") sym=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sym) {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (oot<OrderOpenTime()) oot=OrderOpenTime();
            }
          }
        }
      }
    }
  }
  return(iBarShift(sym, tf, oot, True));
}
int NumberOfBarCloseLastPos(string sy="0", int tf=0, int op=-1, int mn=-1) {
  datetime t;
  int      i, k=OrdersHistoryTotal();

  if (sy=="" || sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
      if (OrderSymbol()==sy) {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderCloseTime()) t=OrderCloseTime();
            }
          }
        }
      }
    }
  }
  return(iBarShift(sy, tf, t, True));
}
int start()
  {
   
   int ticket;
   if(Bars<100)
     {
      Print("bars less than 100");
      return(0);  
     }
   if(TakeProfit<10)
     {
      Print("TakeProfit less than 10");
      return(0);
     }
   if ((NumberOfBarOpenLastPos()>0||NumberOfBarOpenLastPos()==-1)&&(NumberOfBarCloseLastPos()>0||NumberOfBarCloseLastPos()==-1))
     {
      
      if(AccountFreeMargin()<(1000*Lots))
        {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);  
        }
      
      if(Bid>High[1])
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"test",16384,0,Green);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
           }
         else Print("Error opening BUY order : ",GetLastError()); 
         return(0); 
        }
     
      if(Bid<Low[1])
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"test",16384,0,Red);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
           }
         else Print("Error opening SELL order : ",GetLastError()); 
         return(0);  
        }
      return(0);
     }

  }


Here is the code of an EA. You need to:

1) he opened not one, but three deals at once with stops of 25 and takeovers of 15, 35, 50

2) after the second order was closed at take (35), the last position (at take 50) was passed to the breakeven level

Reason: