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

 
My bad, I stand corrected!!! Don't know much of the order. Sorry. I'd like to get a handle on this example.
 
vvs1:
My bad, I stand corrected!!! Don't know much of the order. Sorry. I'd like to get a handle on this example.
 

Guys, please write the minimum code to open a currency transaction basket.

1. Press "Auto Trade" button in the terminal

EURUSD, GBPUSD, AUDUSD, NZDUSD open on a buy lot 0.01, and USDCHF, USDCAD and USDJPY open on a sell lot 0.01

To have an EA in one window
 
Ivan Butko:

Guys, can you please write the minimum code to open a basket of currency trades.

1. Press "Auto Trade" button in the terminal

EURUSD, GBPUSD, AUDUSD, NZDUSD open on a buy lot 0.01, and USDCHF, USDCAD and USDJPY open on a sell lot 0.01

To have an EA in one window

Need a button on the chart

 
Vladimir Karputov:

Need a button on the graph

Thanks for MT5, now need it for MT4.

Thanks in advance)

 

Hello!

The idea is this: I need the Expert Advisor to mark with lines on the chart the places where the price, having been above the upper Bollinger Bands band, goes below the lower band for the first time. But it does not work. What is wrong?

void OnTick()
  {
   int x=1;
   double bblow0=iBands(0,0,110,2.0,0,PRICE_CLOSE,MODE_LOWER,0);
   double bblowX=iBands(0,0,110,2.0,0,PRICE_CLOSE,MODE_LOWER,x);
   double bbupX=iBands(0,0,110,2.0,0,PRICE_CLOSE,MODE_UPPER,x);
   if(Close[0]<bblow0)
     {
      while(Close[x]<bbupX)
        {
         if(Close[x]<bblowX)
           {x=1; break;}
         else
           {x++;}
        }
      if(x>1)
         ObjectCreate(0,"Line"+TimeCurrent(),OBJ_VLINE,0,Time[x],Close[x]);
     }
  }
 
Guys help me find the latest information panel in the EA.
 
int OnInit()
{
//---
OrderSend("EURUSD",OP_SELL,0.01,Bid,3,0,0,"",0,0,0,Red);
//---
return(INIT_SUCCEED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function|
//+------------------------------------------------------------------+


Could you please tell me how to make a function to open a trade only after pressing the "autotrade" button on MT. This code does not work when the button is disabled. I can add some conditions...


 
Ivan Butko:
Maybe add a condition...

Experiment with a script like this:

void OnStart()
{  while(!IsStopped())
   {  if(TerminalInfoInteger(TERMINAL_CONNECTED) && TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) && !IsTradeContextBusy())Comment("Торговля разрешена");
      else Comment("Торговля запрещена!!!");
      Sleep(123); 
   }
   Comment("");

}
 
Igor Makanu:

Experiment with a script like this:

Thanks, but I'm not good at code, unfortunately.

Added your code to my above, the log says it is now not an EA and cannot be opened.

This is for news trading multiple currencies, want such a mechanism:
1. The news comes out
I press the button "autotrade".
3. The Expert Advisor without thinking rubs the broker to open the deal.

Minimized version of the Expert Advisor, only one function - open a deal. I cannot figure out how. The Expert Advisor may be very good (just add the EA on the chart with owls and the EA will do everything by itself), but I would like the EA to open a basket of orders when I activate "auto trade".

I.e., in words I can describe the code roughly as follows:
1. We check if trading is allowed.
2. If not, we wait for the click.
3. Once clicked, the basket of orders is opened.
4. Check for trade authorization not every tick, but... minimum time. The minimum possible time. (check-check-check, instantaneous like this)

Or add "Buy basket with dollar" button on the chart and the basket opens instantly. But, as I understand it is difficult to make the button.

If you know what condition to add or how to implement (if it's simple), please share.