Tradingview2Mt4

Tradingview2Mt4

User can trade directly from tradingview  to mt4 throgh EA 



you need to defined message format in following way and apply given webhook 


message formart

Quantity (Q) - The size of an order specified in normal lot size or percentage. For example: Q=0.1 or Q=10%.

Opening Quantity (OQ) -This parameter is similar to Q. It, however, overrides Q when added to your commands. It is used to specify custom order sizes during the opening of a position, and just like Q, it is specified as quantity or as a percentage of your Balance.

Closing Quantity (CQ) -This parameter is used to specify the quantity to close in cases where your strategy generates a flat command. It overrides the Q in your command. It is helpful when you are using Q as a percentage.

Price (P) - The entry price of your order. It converts your trade to a stop or limit order. Specified as the actual price, as a percentage of the current market price, or as points. For example; P=2%, P=1.1234, P=200, P=-2%, P=-200.

Type (T) – The order type to apply a command to (buy, 1, long) for long orders or (sell, -1, short) for short orders. For example; T=long.

TakeProfit (TP) - Add the take profit of a trade. It can be specified in points, price, or percentage from the entry price. For example; TP=200, TP=1.1234, TP=1%.

StopLoss (SL) - Add the stop loss of a trade. It can be specified in points, price, or percentage from the entry price. Example; SL=200, SL=1.1234, SL=1%.

Trailing Trigger (TT) – The point at which your trailing stop loss for open trades will trigger. It can be specified in points or as a percentage.

Trailing Distance (TD) - This is the distance between which your stop loss and the current market price should be maintained. It can be specified in points or as a percentage.

Trailing Step (TS) - This is the number of points/percentage movement in the market after which your SL should be adjusted. It can be specified in points or as a percentage.

Magic (M) - The trade magic number to use. You can use this to identify different strategies. Example M=1234.

Expiry (E) - Set the expiry period for pending orders in minutes. Example E=30.

Session (S) - Set the market session to execute trades. For example, Buy EURUSD S=06:23-12:32.

Orders (O) - Specify the number of orders you want to apply a command to.
Orders Offset (OO) - Specify the number of orders to skip chronologically.

:Ignore – Use this parameter before any text that you do not want to be displayed.

Note:

-Parameters are not case-sensitive and must be set without spaces in between. Q=0.1 is a valid format, while q = 0.1 is invalid due to the spaces. If a parameter that is not required is sent, it is ignored.

-Downlaod The EA is attached on ONE chart only to trade the other pairs a broker offers.


1. Open an order

Compulsory values -Action and the Symbol.

(Buy, 1, or long)- for long orders or (sell, -1, or short) for short orders. Parameters accepted are Q, P, TP, SL, M, TT, TD, TS, OQ, CQ, and E.

For Strategies;

{{strategy.order.action}}- for a strategy with 'buy' or 'sell' or, {{strategy.market_position}} for a strategy with 'long', 'flat', and 'short' command.

Example for an Indicator:
buy EURUSD Q=0.01, or Short GBPUSD Q=2%, or Buy USDJPY Q=0.2 TT=150 TD=100 TS=50.

Example for a Strategy:

{{strategy.order.action}} EURUSD q=0.01, or {{strategy.market_position}} EURUSD Q=0.01, or {{strategy.market_position}} EURUSD Q=2% CQ=100%.

Kindly note that;.

-If Q is not specified, by default, it will be the minimum allowed lot that will be used.

-If P is specified, it converts it to a limit/stop order.

-Quantity as a percentage with stop loss in the commands; the lot size is calculated based on the percentage to lose in case sl is hit. If SL is not specified, the Lot size will be calculated based on account balance.

2. Cancel a Pending Order

Compulsory Values – Action command (Cancel, Exit) and the symbol. Use this format to cancel an order that hasn't been opened.

Only the T and M parameters can be added to this command.

Example: cancel EURUSD, or Cancel EURUSD T=long

3. Update an Open Trade

Compulsory Values – Update command (modify, update) and the symbol. Use this format to update the Take Profit or Stop Loss of a running trade.

T and M parameters are allowed in this command.

Example: update EURUSD tp=200 to update the tp to 20pips.

Update EURUSD T=short SL=0 to cancel the stop loss.

update EURUSD sl=-1 to Move SL/TP to the entry price.

4. Close a trade

Compulsory Values – Close command (close, flat, 0) and the symbol. Use this format to close a running trade in the market.

Only Q, CQ, T, and M optional parameters are allowed.

Example: close EURUSD. Close EURUSD T=long CQ=100%, or Close EURUSD T=short Q=0.2

5. View Balance

Compulsory values – Balance command (balance, funds, bal). Use this command to check your account balance.

Example: balance, funds, bal

Alert Message Examples

Open a Market Order

-1 EURUSD q=0.1 sl=10% tp=1.23456 (Opens a short trade on your account, a 10% stop loss from the current market price, and a take profit at the price 1.23456.)

-1 EURUSD q=0.1 sl=10% TT=200 TD=150 TS=100 (Opens a short trade on your account, a 10% stop loss from the current market price, and trailing is triggered after 20pips and stop loss places 15pips away from the market price. The stop loss is adjusted after every 10pips price movement.)

{{strategy.order.action}} EURUSD q=0.01 sl=200 tp=5% (Opens a trade according to the strategy direction, with a 20 pips stop loss and a 5% take profit from the current market price.)

{{strategy.market_position}} EURUSD q=5% sl=200 CQ=100% (Opens a trade with a lot size so that, should your trade hit the stop loss of 20pips, you will lose 5% of your account balance. When the flat command is generated, 100% of your position will be closed since CQ is set to 100%.)

{{strategy.market_position}} EURUSD q=5% CQ=100% (Opens a trade with lot size worth 5% of your balance on your account according to the strategy direction. When the flat command is generated, 100% of your position will be closed since CQ is set to 100%.)

Open a Limit Order

Buy EURUSD Q=0.5 p=1.23456 (Opens a buy limit order if the market price is greater than 1.23456 by the minimum number of pips/points required by your broker.)

Buy EURUSD Q=0.5 p=1.23456 TT=200 TD=150 TS=100 (Opens a buy limit order if the market price is greater than 1.23456 by the minimum number of pips/points required by your broker, and trailing will trigger after 20pips and stop loss placed 15pips away from the market price. The stop loss will be adjusted after every 10pips price movement.)

Buy EURUSD Q=0.5 p=-2% (Places a buy limit order at a price 2% below the current market price.)

Sell EURUSD Q=0.5 p=-2% (Places a sell limit order at a price 2% above the current market price.)

Buy EURUSD Q=0.5 p=-200 (Places a buy limit order 20pips below the current market price.)

Sell EURUSD Q=0.5 p=-200 (Places a sell limit order 20pips above the current market price.)

Open a Stop Order

Buy EURUSD Q=0.5 p=1.23456 (Opens a sell-stop order if the market price is less than 1.23456 by at least the minimum number of pips/points required by your broker.)

Buy EURUSD Q=0.5 p=1.23456 TT=200 TD=150 TS=100 (Opens a sell-stop order if the market price is less than 1.23456 by at least the minimum number of pips/points required by your broker, and trailing will trigger after 20pips and stop loss placed 15pips away from the market price. The stop loss will be adjusted after every 10pips price movement.)

Buy EURUSD Q=0.5 p=2% (Places a sell-stop order at a price 2% above the current market price.)

Sell EURUSD Q=0.5 p=2% (Places a sell-stop order at a price 2% below the current market price.)

Buy EURUSD Q=0.5 p=200 (Places a buy-stop order 20pips above the current market price.)

Sell EURUSD Q=0.5 p=200 (Places a sell-stop order 20pips below the current market price.)

Update/Modify a Trade

Update EURUSD tp=200 sl=2% (Updates the tp of a EURUSD trade to 20pips, and the stop loss to 2%.)

Modify EURUSD tp=200 sl=2% t=sell (Updates the tp of a short EURUSD trade to 20pips, and the stop loss to 2%.)

Update EURUSD T=short SL=0 (Cancels the stop loss.)

Update EURUSD sl=-1 (Moves SL to entry price.)

Close A Trade

Close EURUSD (Closes all EURUSD open trades.)

Close EURUSD Q=50% (Partially 50% of EURUSD open trades or positions.)

Close EURUSD T=short Q=50% (closes 50% of EURUSD open short positions/trade.)

Close EURUSD T=long Q=0.2 (Closes 0.2 lots of EURUSD open long positions.)

Cancel a Limit/Stop Order

Cancel EURUSD (Cancel all EURUSD pending orders.)

Cancel EURUSD t=sell (Cancels all EURUSD short pending orders.)

APPLY WEBHOOK




allow webrequest  in mt4
https://api.telegram.org
https://socialtrade.everalgo.com

    • Related Articles

    • TRADING VIEW SETTING

      In TradingView there are two kinds on extensions: strategy alert and study alert A strategy can be backtested and it can't send you an alert. A study can send you an alert but you can't backtest it. You can  converts a strategy into a study. All the ...