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

 

No requotes.

 
Ais:

No requotes.


It only on the fast server

 

kolyango:

Actually, dear "comrade", I take it you're not going to learn, you could have seen how to use variables correctly on the editor's website and in the Help.

extern int     magic                = 1234567890,
               stoploss             = 350,
               takeprofit           = 1000;
extern double  LOT                  = 0.1;
//--------------------------------------------------------------------------------------------
int start()
 {
 int sells=0;
 for (int i=0; i<OrdersTotal(); i++)
   {
     if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
     {
       if (OrderSymbol() !=Symbol() || OrderMagicNumber() !=magic || OrderType() !=OP_SELL ) continue;
       OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3,White);
       sells++;
      }
   }
 if (sells==0) OrderSend(Symbol(),OP_BUY, LOT,NormalizeDouble(Ask,Digits),3,StopLoss,TakeProfit,"",magic,0,Green);
 return(0);
 }
 

People, Humans, learn how to use the MT4 editor's help, it's all there and in detail.

Here is the text from the help.

bool OrderClose( int ticket, double lots, double price, int slippage, color Color=CLR_NONE)
 
//Закрытие позиции. Возвращает TRUE при успешном завершении функции. Возвращает FALSE
//при неудачном завершении функции. Чтобы получить информацию
//об ошибке,необходимо вызвать функцию GetLastError(). 
// Параметры:
// ticket   -  Уникальный порядковый номер ордера. 
// lots     -  Количество лотов для закрытия. 
// price    -  Цена закрытия. 
// slippage -  Значение максимального проскальзывания в пунктах. 
// Color    -  Цвет стрелки закрытия на графике.Если параметр отсутствует или его значение равно
//             CLR_NONE то стрелка на графике не отображается. 

// Пример:
  if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75)
    {
     OrderClose(order_id,1,Ask,3,Red);
     return(0);
    }




 

Happy New Year 2011!!!!


for( i = 0; i < total; i++) {

OrderSelect( ticket,SELECT_BY_TICKET,MODE_TRADES );
if(OrderSymbol() == Symbol() && OrderMagicNumber() == 16384&OrderType() == OP_SELL)
{ if(Nyzhnyayaghranytsa>Close[i])
{ OrderCloseBy (ticket,ticket,Green);Alert("OrderCloseBySell", GetLastError()); }}

OrderSelect( ticket,SELECT_BY_TICKET,MODE_TRADES );
if(OrderSymbol() == Symbol()&&OrderMagicNumber() == 16384 &&OrderType() == OP_BUY)
{ if (Verhnyayaghranytsa<Close[i])
{ OrderCloseBy (ticket,ticket,Green);Alert("OrderCloseByBuy", GetLastError();}} }

I am here inside the bollinger bounds, trying to reverse the order to reverse.Nothing happens,nothing at all,and not even an error or even a zero in the logs!

Maybe there is a comma somewhere?

I have been looking at this place for half an hour!

 

Ask me, I'll give you an answer. I'll ask.

What's the best other turkey to accompany the bollinger?

 
Dimka-novitsek:

Happy New Year 2011!!!!


for( i = 0; i < total; i++) {

OrderSelect( ticket,SELECT_BY_TICKET,MODE_TRADES );
if(OrderSymbol() == Symbol() && OrderMagicNumber() == 16384&&OrderType() == OP_SELL)
{ if (Nyzhnyayaghranytsa>Close[i])
{ OrderCloseBy (ticket,ticket,Green);Alert("OrderCloseBySell", GetLastError()); }}

OrderSelect( ticket,SELECT_BY_TICKET,MODE_TRADES );
if(OrderSymbol() == Symbol()&&OrderMagicNumber() == 16384 &&OrderType() == OP_BUY)
{ if (Verhnyayaghranytsa<Close[i])
{ OrderCloseBy (ticket,ticket,Green);Alert("OrderCloseByBuy", GetLastError());}} }

I am inside the bollinger bounds here, I try to reverse the order when it touches. Nothing happens, nothing at all, and not even an error or even a zero in the logs!

Maybe a comma is missing somewhere?

I've been looking at this place for half an hour!

Well, first, you are looking for a closed bar "if (Verhnyayaghranytsa<Close[i]" where i you have = 0, and this is a bar that has not yet closed, you should either change it to Open or Close[i+1].

Second, OrderCloseBy(int ticket, int opposite, colour Color=CLR_NONE), where ticket and opposite are different order numbers of different orders.

Third, OrderCloseBy does not flip from one order to another, it flips the deposit, instead of closing it and opening a new one in the opposite direction.
You have to close the old one yourself and open a new one.

 
Dimka-novitsek:

Happy 2011!!!!

----------------------------------------------

I've been looking at this place for half an hour!

Why don't you go and get yourself a beer and some fish, or some champagne and a fruit selection, and you'll see if you get some 'enlightenment'...:-)))

Happy New Year!

 

The question is a classic one. WHAT TO DO?))

 
Rest, celebrate :) Traders have the weekend off!