Market Order

Market Orders- Market order is a commitment to the brokerage company to buy or sell a security at the current price. Execution of this order results in opening of a trade position. Securities are bought at ASK price and sold at BID price. Stop Loss and Take Profit orders (described below) can be attached to a market order.

Placing a Market Order-

License_ID, buy, XAUUSD ,lot,price  - Correct Syntax

License_ID, buy, XAUUSD,lot  - Correct Syntax

Note – For Market order ‘price’ is not required, If syntax comes with ‘price’, ‘price’ will be ignored.


Ex- 

License_ID, buy, XAUUSD ,0.50

LIMIT Order

BUY LIMIT Order - 

License_ID, buylimit, XAUUSD ,lot,price

SELL LIMIT Order - 

License_ID, selllimit, XAUUSD ,lot,price

Note- Price is mandatory field for Limit Order.


Buy Limit – buy provided the future "ASK" price is equal to the pre-defined value. The current price level is higher than the value of the placed order. Orders of this type are usually placed in anticipation of that the security price, having fallen to a certain level, will increase.

Sell Limit – sell provided the future "BID" price is equal to the pre-defined value. The current price level is lower than the value of the placed order. Orders of this type are usually placed in anticipation of that the security price, having increased to a certain level, will fall


SL Orders

Stop loss for BUY Order- 

License_ID, buysl, XAUUSD, lot, price


Stop loss for Sell Order- 

License_ID, sellsl, XAUUSD, lot, price


Stop Loss order-
This order is used for minimizing of losses if the security price has started to move in an unprofitable direction. If the security price reaches this level, the position will be closed automatically. Such orders are always connected to an open position or a pending order. The brokerage company can place them only together with a market or a pending order. Terminal checks long positions with BID price for meeting of this order provisions (the order is always set below the current BID price), and it does with ASK price for short positions (the order is always set above the current ASK price).

Take Profit Orders

Take Profit Order for BUY - 

License_ID, buytp, XAUUSD ,lot,price

Take Profit Order for SELL - 

License_ID, selltp, XAUUSD ,lot,price

Take Profit

Take Profit order is intended for gaining the profit when the security price has reached a certain level. Execution of this order results in closing of the position. It is always connected to an open position or a pending order. The order can be requested only together with a market or a pending order. Terminal checks long positions with BID price for meeting of this order provisions (the order is always set above the current BID price), and it does with ASK price for short positions (the order is always set below the current ASK price).

BUY Stop/Sell Stop Orders

BuyStop order - (Place buy order above the market price)

License_ID, buystop, XAUUSD, lot, price

The BuyStop command is used to place a buy order at a price higher than the current market price. For example, if the market price of XAUUSD is 2600 and you want to place a buy order at 2625, you would use the Buy Stop command to do so. When XAUUSD reaches 2625, your buy order will be executed.

SellStop order - (Place buy order above the market price)

License_ID, sellstop, XAUUSD, lot, price

The SellStop command is used to place a sell order at a price lower than the current market price. For example, if the market price of XAUUSD is 2600 and you want to place a sell order at 2585, you would use the sellStop command to do so. When XAUUSD reaches 2585, your sell order will be executed.

closebuy/closesell Orders

To CloseBuy at market order (Partially)- 

License_ID, closebuy, XAUUSD,lot

Note- To close buy partially lot size need to define and price is not required for closebuy command.

To CloseBuy at market order (completely)- 

License_ID, closebuy, XAUUSD

Note- To close buy completely no need to define lot size. 


To CloseSell at market order (Partially)- 

License_ID, closesell, XAUUSD,lot

Note- To close sell partially lot size need to define and price is not required for closesell command.

To Closesell at market order (completely)- 

License_ID, closesell, XAUUSD

Note- To close sell completely no need to define lot size. 


CloseAll Order

To close all positions for a particular Symbol-

License_ID, closeall, XAUUSD

Note- closeall command will close all the open positions (buy or sell positions) for XAUUSD symbol.
 

Cancel pending orders

Cancelling pending orders- 

We can cancel all orders which are pending.

Pending Order commands - buylimit, selllimit, buystop, sellstop, buytp, selltp, buysl, sellsl

Note- Need to add cancel as prefix to cancel a pending order, Lot size and price is not required for cancel order command.

License_ID, cancelbuylimit, XAUUSD

License_ID, cancelselllimit, XAUUSD

License_ID, cancelbuystop, XAUUSD

License_ID, cancelsellstop, XAUUSD

License_ID, cancelbuysl, XAUUSD

License_ID, cancelsellsl, XAUUSD

License_ID, cancelbuytp, XAUUSD

License_ID, cancelselltp, XAUUSD

Note- Market order can not be cancelled 


Meta Trader 4

1. Download MetaConnector EA
In your MetaConnector Portal, navigate to the "Download" section in the left menu and download the MetaTrader 4 MetaConnector EA.


Follow these steps to unzip the file:
  • When you click on the MT4 download button, a zip file will be downloaded. You need to unzip it.

  • Right-click on the zip file, select "Extract All," and extract the files.


  • Your file is now unzipped, you can use it


2. Access the Experts Folder

On the upper left corner of your MetaTrader 4, click “File” → “Open Data Folder”.


  • In your Data Folder, click on “MQL4”.


  • In your MQL4 folder, click on “Experts”.



3. Add MetaConnector EA

In your Experts folder, paste the MetaConnector EA you just downloaded. The file type of the EA is “EX4 File”.


4. Allow DLL Imports & Configure WebRequest

At the top of your MetaTrader 4, go to “Tools” → “Options” → and check the box for “Allow DLL imports”.

  • Enable “Allow WebRequest for listed URL” and add the following URL:



5. Enable Auto Trading

At the top of your screen, ensure that “AutoTrading” is in green.

 

6. Attach MetaConnector EA

Open Navigator by pressing “Ctrl+N” → Right-click on “Expert Advisors” → Click “Refresh”.


  • Right-click on the MetaConnector MT4 EA and select “Attach to a chart”.


7. Allow Live Trading and DLL Imports

In the Common tab of your MetaTrader terminal, check "Allow live trading" and "Allow DLL imports".


8.  Input License ID

Copy your License ID from your Licensing Dashboard in your Meta Connector Portal.


9. Check Connection

After entering your License ID, check that you have successfully connected to the Meta Connector server.



Note - If you want to trade XAUUSD then EA needs to attach on the XAUUSD chart and the alert signal must be the same as the meta trader.

Meta Trader 5

1. Download MetaConnector EA

In the Downloads tab of your MetaConnector Portal, under MT5 EA, click on Download.


Follow these steps to unzip the file:
  • When you click on the MT5 download button, a zip file will be downloaded. You need to unzip it.


  • Right-click on the zip file, select "Extract All," and extract the files.



  • Your file is now unzipped, you can use it


2.  
Access the Experts Folder

In the upper left corner of your MetaTrader 5, click File → Open Data Folder.


  • In your Data Folder, click on MQL5.

  • In your MQL5 folder, click on Experts.


3. Add MetaConnector DLL and EA

In your Experts folder, extract the zip file you downloaded and place the files in the Experts folder. There should be two files:

  • MetaConnector-MT5-DLL
  • MetaConnector-MT5-EA


4. Allow DLL Imports

At the top of your MetaTrader 5, go to Tools → Options → and check the box for Allow DLL imports.

  • The WebRequest URL is no longer required for MetaConnector MT5 v3.37 and later versions, so you can leave this field blank.


5. Enable Auto Trading

At the top of your screen, make sure that Algo Trading is highlighted in green.


6. Attach MetaConnector EA

Open Navigator by pressing Ctrl+N → Right-click on Expert Advisors → Click Refresh.


  • Right-click on the MetaConnector MT5 EA and click Attach to Chart.


7. Allow Algo Trading and DLL Imports

In the Common tab, check the box for Allow Algo Trading.


  • Under Dependencies, tick Allow DLL imports.
8. Input License ID

Go to your Meta Connector members’ area and copy your License ID from the Licensing Dashboard.

  • In the Inputs tab, paste your License ID and click OK


9. Check Connection

After entering your License ID, verify that you have successfully connected to the Meta Connector server.


Welcome to MetaConnector — Let’s help you get started quickly!
Have questions or need help? Contact us anytime!


1. Compatible Operating System

• Windows - Supports Windows 10 and 11.

• Windows Server - Compatible with 2016, 2019, and 2022 versions.

• MacOS -  Non-DLL EAs may work but could be unstable using a Windows VPS is recommended.

Tip for MacOS Users: Use a Windows app for smoother VPS navigation. Need help? Check out our VPS setup guide!

Incompatible Operating Systems

• Windows 8 or Older: Upgrade to Windows 10 or 11.

• Windows Server 2012: Upgrade to Windows Server 2016, 2019, or 2022.

• MetaQuotes VPS: Switch to an alternative like MetaConnector VPS.

How to Check Your Windows Version

1. Press the Windows Logo Key + R to open the Run dialog.

2. Type Winver in the box and hit Enter or click OK.

The "About Windows" box will appear, showing your Windows version and build number.

TradingView Plan Requirement

Make sure you have the Essential Plan on TradingView.

TradingView Plan Needed for Automation

To automate your TradingView strategies, make sure you're on one of these plans:

Essential, Plus, Premium, Expert, Elite, or Ultimate

These plans let you send webhook alerts for automation.

3. Setting up MetaConnector EA 

• Make sure your operating system is compatible.

• Follow the setup guide to install MetaConnector EA on your MetaTrader 4 or 5 terminal.

Refer to the relevant guide for detailed instructions.

4. Send Test Alert 

Once you’ve set up the MetaConnector EA on your MT4/5 terminal, send a few test alerts. This helps verify your connection and gives you a chance to get familiar with the workflow before going live.

5. Understand the MetaConnector Syntax

The syntax is how you write alert messages to trigger actions in your MetaTrader terminal. Getting familiar with the MetaConnector syntax will help you automate your trading strategies effectively.

6. Explore Key EA Options
  • Target Type
  • Volume Type
  • Close on Reverse
  • Pyramiding

Experiment with different settings by sending test alerts. For example, change the Target Type from pips to percentage to see how the targets adjust, or switch the Volume Type from Lots to Percentage of Balance to calculate volume based on stop-loss and risk values.

7. Use the Super Trendy Strategy

• SuperTrend Strategy is a popular trend-following system, perfect for exploring MetaConnector’s capabilities. Like a moving average crossover, it follows market trends to provide clear buy and sell signals. It works well for both short-term scalping and long-term trading.

8. Set Up TradingView Script and Alerts

After understanding the EA options and MetaConnector Syntax, configure your TradingView strategy or indicator script and set up alerts. Make sure the alerts trigger the correct trades on your MT4/5 terminal.

9. Improve Your Setup

Starting with MetaConnector is just the first step. To truly succeed, keep learning and refining your setup:

  •  Monitor Your System

Check the MetaConnector Signal Logs and the MetaTrader Experts tab regularly to ensure everything works smoothly.

  •  Adjust

Try different EA settings, like risk levels or trade sizes, to find what works best for you.

  •  Upgrade Your Strategy 

Update your TradingView scripts by tweaking stop-loss, take-profit, or other parameters to improve results.

Each small change helps you grow and optimize your trading automation.


//@version=6

strategy("Moving Average Crossover Strategy-Meta Connector", overlay=true, process_orders_on_close=true)

//Need to import below libarary, to use syntax in your code
//If you don't want to use libarary please share our syntax format with you developer https://www.metaconnector.combiz.org/documentation/Index#13
import garvthakurcom/metaconnector/2 as syntax

// Input parameters
short_ma_length = input.int(20, title="Short MA Length", inline="1")
long_ma_length = input.int(100, title="Long MA Length", inline="1")
trade_lot_size = input.float(0.02, title="Lot Size", inline="2")
profit_target_points = input.float(200, title="Partial Exit at Points", step=0.1, inline="2")
license_id = input.string(defval="License ID from MetaConnector Login", title="License Id",inline = '3')
trade_symbol = input.string(defval="XAUUSD", title="Symbol",inline = '3')

//Note- Enter your license ID from Meta-connector
//trade_symbol must be as per meta trader 4/5
// Calculate Moving Averages
short_moving_avg = ta.sma(close, short_ma_length)
long_moving_avg = ta.sma(close, long_ma_length)

// Detect MA crossovers
is_bullish_crossover = ta.crossover(short_moving_avg, long_moving_avg)
is_bearish_crossover = ta.crossunder(short_moving_avg, long_moving_avg)

// Variables for order handling
var float entry_price = na
var float exit_price_target = na

// Handle buy signal
if is_bullish_crossover
// Close existing sell positions
close_sell_message = syntax.close_sell_positions(License_ID=license_id, symbol=trade_symbol)
strategy.close("Sell", alert_message=close_sell_message)

// Place buy orders
buy_order_message = syntax.buy_market_order(License_ID=license_id, symbol=trade_symbol, lot=str.tostring(trade_lot_size))
strategy.entry("Buy", strategy.long, qty=trade_lot_size, alert_message=buy_order_message)

// Set profit target for partial exit
entry_price := close
exit_price_target := entry_price + profit_target_points

partial_buy_exit_message = syntax.close_partial_buy_position(License_ID=license_id, symbol=trade_symbol, lot=str.tostring(trade_lot_size / 2))
strategy.exit("Partial Buy Exit", from_entry="Buy", qty_percent=50, limit=exit_price_target, alert_message=partial_buy_exit_message)

// Handle sell signal
if is_bearish_crossover
// Close existing buy positions
close_buy_message = syntax.close_buy_positions(License_ID=license_id, symbol=trade_symbol)
strategy.close("Buy", alert_message=close_buy_message)

// Place sell orders
sell_order_message = syntax.sell_market_order(License_ID=license_id, symbol=trade_symbol, lot=str.tostring(trade_lot_size))
strategy.entry("Sell", strategy.short, qty=trade_lot_size, alert_message=sell_order_message)

// Set profit target for partial exit
entry_price := close
exit_price_target := entry_price - profit_target_points

partial_sell_exit_message = syntax.close_partial_sell_position(License_ID=license_id, symbol=trade_symbol, lot=str.tostring(trade_lot_size / 2))
strategy.exit("Partial Sell Exit", from_entry="Sell", qty_percent=50, limit=exit_price_target, alert_message=partial_sell_exit_message)

// Plot moving averages
plot(short_moving_avg, color=color.blue, title="Short Moving Average (20)")
plot(long_moving_avg, color=color.orange, title="Long Moving Average (100)")

Free TradingView Alert Setup

Good News ! Our Meta connector is the world's first tradingView to meta trader bridge which support trade execution on Meta Trader from free TradingView account but there are some limitations, you can only set one alert on free TradingView account.

Step 1 - You need to modify your pinescript code as per our meta connector to check alert "Syntax Format" of documentation page.  We also have shared a sample code in our documentation page. Check Sample Pine Script code

Step 2- We need Free TradingView account session ID which we need to enter in login of meta connector. To get session id, we need to go in to inspect window of tradingview session.  Click CTR+Shift+I on windows and Command+Options+I on Macbook. Make sure you are on tradingView page and you are logged in into tradingview free account to press the above mentioned command.

Step 3- Click on the Application tab to open it, then double-click on "Storage" to view the stored data and settings.


Step 4 - After opening "Storage," you will see "Cookies." Double-click on "Cookies" to locate the session ID.


Step 5 - Scroll down to Find the "Session ID" on Trading View, then click on it to select.


Step 6 - Copy the Session ID from Trading View to use it as your "Session ID." 


Step 7 - Open the user login page, enter your ID and Password, and click on "Login."


Step 8 - Click on "Free Trading View."


Step 9 - Enter the "Session ID" here.


Free Trading View

1- Open desired chart on which you want to apply strategy and apply desired time frame.


2- Now move to right side and look for alert icon which is similar to clock icon and click.


3- Now click plus icon to create new alert. after clicking + icon a popup will open.


4- Verify symbol and time frame, in condition box choose strategy or indicator, choose expiration date of your choice and in message box Copy and paste this message.  {{strategy.order.alert_message}}   and click create. 

     

5- Verify if generated alerts are correct, alert only will be generated when strategy gives any entry or exit. 

I can see my alert format is correct because my format is license_ID, command, Symbol, lot Size. so this alert must reach to my meta trader if i have setup Meta_Connector EA correctly.


Paid TradingView

1- Open desired chart on which you want to apply strategy and apply desired time frame.


2- Now move to right side and look for alert icon which is similar to clock icon and click.


3- Now click plus icon to create new alert. after clicking + icon a popup will open.


4- Go on Notification tab next to setting, and check box of webhook URL and copy and paste webhook url -  https://metaconnector.combiz.org/webhook 


5- Move back to setting tab on popup and Verify symbol and time frame, in condition box choose strategy or indicator, choose expiration date of your choice and in message box Copy and paste this message.  {{strategy.order.alert_message}}   and click create.

      

5- Verify if generated alerts are correct, alert only will be generated when strategy gives any entry or exit. 

I can see my alert format is correct because my format is license_ID, command, Symbol, lot Size. so this alert must reach to my meta trader if i have setup Meta_Connector EA correctly.


License_ID, command, symol, lot, price

This is the universal syntax, which is allowed and acceptable in Meta Connector.

Reverse Order

Suppose you want to close existing buy or sell position and want to open a new position to perform these action need to use "closebuysell" or "closesellbuy" commands.

Example - License_ID, closebuysell, XAUUSD ,lot

Note- this command will closebuy position of defined lot size in the command and this will open a new sell order with defined lot size in given command.

Example - License_ID, closesellbuy, XAUUSD ,lot

Note- this command will closesell position of defined lot size in the command and this will open a new buy order with defined lot size in given command.