[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 147

 
first_may:
On the subject of candle colouring, can anyone suggest it?

Decide first what to do with the third option
 
How about this: "If the closing price of a candle is greater than or equal to MA 21, then it's a green candle, otherwise it's a red one. "?
 
first_may:
How about this: "If the closing price of a candle is greater than or equal to MA 21, then it's a green candle, otherwise it's a red one. "?

This one does not work. Not the best one, of course.
 
Thank you, I will think about it.
 
Vinin:

Before the weekend, the spread increases. And quite a lot.

Vinin please reply will the spreads come back on Monday and will the previous results come back? thank you
 
laveosa:

Vinin can you please tell me if the spreads will come back on Monday and will the results be the same as before? thank you

What can they do. Of course they will.
 

Good night,

I need a command to open an order after the EA is turned on, I am trying the line

int start()
{int j = OrdersTotal()-1; j >= 0; j--)
{
if(OrderSelect(j, SELECT_BY_POS)
}

return(0);
}

an error is thrown

This line was found in the MT4 Tutorials on the Internet

 
Dip:

Good night,

I need a command to open an order after entering an EA.

int start()
{int j = OrdersTotal()-1; j >= 0; j--)
{
if (OrderSelect(j, SELECT_BY_POS)
}

return(0);
}

I get an error

I found this string on the Internet in MT4 tutorials

Use the Tutorial and Documentation here on the website above! You must do everything strictly according to the rules, then the software will give the command to open!
 
Dip:

Good night,

I need a command to open an order after entering an EA.

int start()
{int j = OrdersTotal()-1; j >= 0; j--)
{

if (OrderSelect(j, SELECT_BY_POS))

//if (OrderSelect(j, SELECT_BY_POS)
}

return(0);
}

I get an error

I found this string on the Internet in MT4 tutorials

But there is no command in your code to open an order...
 

Please tell me why the EA does not open trades Error 130.Stop Loss = 55 pips (4 digits of quotes)

 bool NewBar()
  {
       static datetime lastbar = 0;
       datetime curbar = iTime(Symbol(), 0, 0);
       if(lastbar!=curbar)
       {
             lastbar=curbar;
             return (true);
       }
       return(false);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
    int ticket;
    double price,takeprofit,stoploss,Lots;
//----
    double frUP = iFractals(NULL,0,MODE_UPPER,3);
    double frLOW = iFractals(NULL,0,MODE_LOWER,3);
    double lwma = iMA(NULL,0,PeriodLWMA,0,MODE_LWMA,PRICE_CLOSE,0);
    if(OrderType()==OP_BUYSTOP)
       {
       price = NormalizeDouble(frUP+(Ask-Bid)+30*Point,Digits);
       takeprofit = NormalizeDouble(price+tp*Point,Digits); 
       stoploss = NormalizeDouble(price-sl*Point,Digits);
       }
    if(OrderType()==OP_SELLSTOP)
       {
       price = NormalizeDouble(frLOW-30*Point,Digits);
       takeprofit = NormalizeDouble(price-tp*Point,Digits);
       stoploss = NormalizeDouble(price+sl*Point,Digits);
       }
       double MaxLot = MarketInfo(Symbol(),MODE_MAXLOT);
       double MinLot = MarketInfo(Symbol(),MODE_MINLOT);
       Lots = NormalizeDouble(AccountFreeMargin()/10*MaxRisk/1000,2);
    if(Lots>MaxLot)
       Lots = MaxLot;
    if(Lots<MinLot)
       Lots = Lot;
//----
    static bool flag = true;
    if(NewBar())
      flag = true;
      if(Ask>lwma && frUP>0 && flag)
         {
         ticket = OrderSend(Symbol(),OP_BUYSTOP,Lots,price,5,stoploss,takeprofit,"Fractal",123,0,Blue);
         Print("Ошибка № ",GetLastError());
         if(ticket>0 && GetLastError()==0)
            flag = false;
            return(ticket);
         }
//-------------------------------------------------------------------
    if(NewBar())
      flag = true;
      if(Bid<lwma && frLOW>0 && flag)
         {
         ticket = OrderSend(Symbol(),OP_SELLSTOP,Lots,price,5,stoploss,takeprofit,"Fractal",123,0,Red);
          Print("Ошибка № ",GetLastError());
         if(ticket>0 && GetLastError()==0)
            flag = false;
            return(ticket);
         }
  }
//+-------------------------------------