Hello, I want a script, in which I can open both buy and sell trades on 1 click. Can it be possible? ٰIf yes please help me. I'm using mt5.
- Flexible MetaTrader 5 trading system with all order types
- Web version features
- Subscribe to a trade signal straight from MetaTrader 5
//+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- Check if the script is running on a chart if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) { Alert("Trading is not allowed. Check the 'Allow live trading' setting in the terminal."); return; } //--- Get the symbol from the current chart string symbol = Symbol(); //--- Ask the user for the lot size double lots = NormalizeDouble(InputDialog("Lot Size", "Enter the lot size for the trades:", 0.01), 2); if(lots == 0.0) { Alert("Invalid lot size entered. Operation cancelled."); return; } //--- Open a buy trade trade.Buy(lots, symbol); //--- Open a sell trade trade.Sell(lots, symbol); //--- Display a message to confirm the trades Alert("Buy and Sell trades opened successfully for ", symbol, " with lot size ", lots); } //+------------------------------------------------------------------+
NOTE: this script assumes you have already set up trade parameters (SL, TP, etc).
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register