HOW-TO: Execute closed-source script alerts via TradingConnectorHOW-TO: Auto-Execute closed-source script alerts using TradingConnector
(Assuming alerts don't match required syntax and script author won't adjust)
TradingView hosts numerous Pine-Scripts with alerts generated by those scripts. Oftentimes, you discover an indicator or strategy with promising parameters, and to top it off, the alerts trigger precisely when needed. It feels as though the entire setup is pleading, "Automate me!"
However, there's a challenge. Many times, these scripts are closed-source, and the alert messages they produce don't align with the execution service's syntax requirements. Moreover, the script author may not be inclined to modify these alerts.
Introducing the "Search&Replace Alerts Modifier" Module
TradingConnector has recently introduced the “Search&Replace Alerts Modifier” module, offering a solution to this issue. This module acts as a bridge between alerts generated by closed-source scripts and the expected syntax of TradingConnector. By intercepting alerts fired from TradingView, the Alerts Modifier adjusts them using a familiar Search&Replace mechanism. Consequently, these alerts are aligned with the required syntax before being forwarded for execution in MetaTrader.
Configuring the Alerts Modifier is straightforward. Users only need to specify two strings of text for Search&Replace: one to identify within the incoming alert and the other to replace it in every occurrence.
Example Scenario
Consider an alert generated by a closed-source script:
{"id": 1701248700,"symbol": "XAUUSD","command": "short tradesymbol=XAUUSD lot=0.01","time": 1701248700}
This alert, in its current form, wouldn't be parsed by TradingConnector due to the absence of an expected keyword like short . It contains a partial occurrence of the term ( "...mind": "short" ) that wouldn't be recognized.
Processing this alert through the Search&Replace Alerts Modifier, with a specification to replace " symbol with a plain space , transforms the alert into a recognizable format:
{ id : 1701248700, symbol : XAUUSD , command : short tradesymbol=XAUUSD lot=0.01 , time : 1701248700}
Now, the distinct short keyword is recognizable, enabling the alert's execution in MetaTrader. Moreover, irrelevant words ( time, id, symbol, command ) or strings ( :1701248700, XAUUSD ) are intelligently ignored without causing any disruption.
Customization and Flexibility
Users can configure multiple search&replace pairs of strings, facilitating comprehensive customization to accommodate various alert formats and syntax variations.
By incorporating the "Search&Replace Alerts Modifier" alongside TradingConnector, traders can seamlessly handle alerts from closed-source scripts that diverge from the expected syntax. This module acts as a pivotal tool, reconciling these discrepancies and enabling the automated execution of alerts in MetaTrader without necessitating modifications to the original scripts.
Mt4
Auto-delivering TradingView Alerts into MT4, MT5Check out TradingConnector (dot_com), an integration tool, which enables auto-delivery of TradingView Alerts in to MT4 and MT4, to trade Forex, commodities and indices!
Delivery time is below 1 second, so it can be even used for scalping, as well as higher timeframe trading.
Disclaimer: This is no financial advice nor any financial service. Remember – 95%+ traders lose money. You are trading at your own risk.
EURUSD LONG - TradingView to MT4 BotSide: Long
Risk: 10%
SL: 60 pips
Noice start this week!
SEND SIGNALS FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
POSSIBLE COMMANDS
Open Orders
buy_SYMBOL_SLinPoints_Risk%
sell_SYMBOL_SLinPoints_Risk%
buy_SYMBOL_SLinPrice_Risk%
(can be used for dynamic values)
sell_SYMBOL_SLinPrice_Risk%
(can be used for dynamic values)
buy_EURUSDi_150_0.05 = opens a buy order on EURUSD with an SL 150 points away with 5% risk if SL triggers
sell_EURUSDi_1.10200_0.03 = opens a sell order on EURUSD with an SL at 1.10200 with 3% risk if SL triggers
Close Orders
close_SYMBOL_%toClose_none
close_SYMBOL_%toClose_break
close_SYMBOL_%toClose_(price)
(can be used for dynamic values)
close_EURUSD_50_none = closes 50% of an open order and SL stays the same
close_EURUSD_0_break = closes 0% of an open order and SL moves to breakeven if trade is in profit
close_EURUSD_25_1.10200 = closes 25% of an open order and SL moves to price that is stated
Update Orders
update_SYMBOL_SL1_SL2
(can be used for dynamic values)
The logic of this command differs slightly and serves as a trailing stop between two dynamic values if your indicator provides that.
For example, if current trade is a BUY, after sending this command, it will move Stop Loss to SL1, if it’s a SELL, it will move Stop Loss to SL2.
update_EURUSDcn_1.10300_1.10100 = If we are in a BUY, Stop Loss would be updated to 1.10300. If we were in a SELL, Stop Loss would be updated to 1.10100.
If you used dynamic values in trading view, the command would essentially look like this: update_EURUSDcn_{{plot_3}}_{{plot_4}}
SEND ALERTS FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
WHY RISK MANAGEMENT?
Trading can be very lucrative, we all know that, hence; why we became traders in the first place. Whether you found an awesome indicator script on TradingView, an Expert Advisor on MT4, or whatever other strategy that got you excited about trading in the first place; you will lose no matter how perfect a strategy works.
I started trading with a strategy that had over 60% win rate and still lost half of my account. You may think I’m an idiot. I just didn’t understand it’s more important to know how much you can lose rather than how much you can make. So from now on, forget about gains. If your strategy’s win rate is above 50%, focusing on how much you can lose will always be more important. The gains will come on their own after that.
Risk management is simple and only involves basic math. So let’s start with that: To understand the calculator in it’s entirety, you must know how to calculate profit from a winning position. We’ll use a FOREX example.
Let’s say bought 1.00 Lot of EURUSD at 1.00100, a couple hours or minutes later, you closed it at 1.00200. First you subtract Close Price from Entry Price to get the amount of points you gained:
1.00200 - 1.00100 = 0.00100
100 points gain or 10 pips
To calculate dollar profit you multiply by Lot Size and multiply again by 100,000.
0.00100 * 1.00 * 100,000 = $100
Gain * Lot Size * 100,000 = $
Great, so you made $100! If your balance was $1,000, you just made 10% return, amazing! But.. what if the trade had gone wrong? How do you even calculate how much you might lose? Well first, you have to choose a Stop Loss, this varies depending on your strategy. One of my 30m strategies has a Stop Loss between 150-200 points, while a 4hr strategy might have a Stop Loss between 600-650 points.
Let’s say you’ve made up your mind and you’re going to choose a Stop Loss at 150 points, which means if price is at 1.00150, your stop loss would end up at 1.00000 on a Buy Trade. The key thing first is deciding what % of your balance you’re willing to risk. If I have $1000, you might be okay with losing 5%, which is $50. Now you use the formula above:
Gain * Lot Size * 100,000 = $
In this case, we would substitute Gain with Stop Loss value instead.
Stop Loss * Lot Size * 100,000 = $
150 * Lot Size * 100,000 = $50
As you can see, we have to solve for Lot Size because we don’t know exactly how much to trade yet if our trade hits our Stop Loss, we’ll only lose $50. I won’t go into the algebra, so here is the final formula:
Lot Size = 1 / (SL in Points / (Capital x Risk%))
Lot Size = 1 / (150 / ($1000 * 5%)) = 0.33
Trading 0.33 lot size with a hard Stop Loss of 150, we’ll only lose $50 or 5% of our balance.
That’s basic risk management, and it’ll save you headaches from losing money on your trades. Don’t worry about doing the math yourself though, use our bot that auto-calculates your position based on your risk. Happy trading!
SEND TRADES FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
GBPUSD SHORT - TradingView to MT4 BotAlmost got stopped out on this one lol
Side: Short
Risk: 10%
SL: 70 pips
SEND SIGNALS FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
POSSIBLE COMMANDS
Open Orders
buy_SYMBOL_SLinPoints_Risk%
sell_SYMBOL_SLinPoints_Risk%
buy_SYMBOL_SLinPrice_Risk%
(can be used for dynamic values)
sell_SYMBOL_SLinPrice_Risk%
(can be used for dynamic values)
buy_EURUSDi_150_0.05 = opens a buy order on EURUSD with an SL 150 points away with 5% risk if SL triggers
sell_EURUSDi_1.10200_0.03 = opens a sell order on EURUSD with an SL at 1.10200 with 3% risk if SL triggers
Close Orders
close_SYMBOL_%toClose_none
close_SYMBOL_%toClose_break
close_SYMBOL_%toClose_(price)
(can be used for dynamic values)
close_EURUSD_50_none = closes 50% of an open order and SL stays the same
close_EURUSD_0_break = closes 0% of an open order and SL moves to breakeven if trade is in profit
close_EURUSD_25_1.10200 = closes 25% of an open order and SL moves to price that is stated
Update Orders
update_SYMBOL_SL1_SL2
(can be used for dynamic values)
The logic of this command differs slightly and serves as a trailing stop between two dynamic values if your indicator provides that.
For example, if current trade is a BUY, after sending this command, it will move Stop Loss to SL1, if it’s a SELL, it will move Stop Loss to SL2.
update_EURUSDcn_1.10300_1.10100 = If we are in a BUY, Stop Loss would be updated to 1.10300. If we were in a SELL, Stop Loss would be updated to 1.10100.
If you used dynamic values in trading view, the command would essentially look like this: update_EURUSDcn_{{plot_3}}_{{plot_4}}
SEND ALERTS FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
WHY RISK MANAGEMENT?
Trading can be very lucrative, we all know that, hence; why we became traders in the first place. Whether you found an awesome indicator script on TradingView, an Expert Advisor on MT4, or whatever other strategy that got you excited about trading in the first place; you will lose no matter how perfect a strategy works.
I started trading with a strategy that had over 60% win rate and still lost half of my account. You may think I’m an idiot. I just didn’t understand it’s more important to know how much you can lose rather than how much you can make. So from now on, forget about gains. If your strategy’s win rate is above 50%, focusing on how much you can lose will always be more important. The gains will come on their own after that.
Risk management is simple and only involves basic math. So let’s start with that: To understand the calculator in it’s entirety, you must know how to calculate profit from a winning position. We’ll use a FOREX example.
Let’s say bought 1.00 Lot of EURUSD at 1.00100, a couple hours or minutes later, you closed it at 1.00200. First you subtract Close Price from Entry Price to get the amount of points you gained:
1.00200 - 1.00100 = 0.00100
100 points gain or 10 pips
To calculate dollar profit you multiply by Lot Size and multiply again by 100,000.
0.00100 * 1.00 * 100,000 = $100
Gain * Lot Size * 100,000 = $
Great, so you made $100! If your balance was $1,000, you just made 10% return, amazing! But.. what if the trade had gone wrong? How do you even calculate how much you might lose? Well first, you have to choose a Stop Loss, this varies depending on your strategy. One of my 30m strategies has a Stop Loss between 150-200 points, while a 4hr strategy might have a Stop Loss between 600-650 points.
Let’s say you’ve made up your mind and you’re going to choose a Stop Loss at 150 points, which means if price is at 1.00150, your stop loss would end up at 1.00000 on a Buy Trade. The key thing first is deciding what % of your balance you’re willing to risk. If I have $1000, you might be okay with losing 5%, which is $50. Now you use the formula above:
Gain * Lot Size * 100,000 = $
In this case, we would substitute Gain with Stop Loss value instead.
Stop Loss * Lot Size * 100,000 = $
150 * Lot Size * 100,000 = $50
As you can see, we have to solve for Lot Size because we don’t know exactly how much to trade yet if our trade hits our Stop Loss, we’ll only lose $50. I won’t go into the algebra, so here is the final formula:
Lot Size = 1 / (SL in Points / (Capital x Risk%))
Lot Size = 1 / (150 / ($1000 * 5%)) = 0.33
Trading 0.33 lot size with a hard Stop Loss of 150, we’ll only lose $50 or 5% of our balance.
That’s basic risk management, and it’ll save you headaches from losing money on your trades. Don’t worry about doing the math yourself though, use our bot that auto-calculates your position based on your risk. Happy trading!
SEND TRADES FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
EURUSD SHORT - TradingView to MT4 BotSide: Short
Risk: 5%
SL: 20 pips
SEND SIGNALS FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
POSSIBLE COMMANDS
Open Orders
buy_SYMBOL_SLinPoints_Risk%
sell_SYMBOL_SLinPoints_Risk%
buy_SYMBOL_SLinPrice_Risk%
(can be used for dynamic values)
sell_SYMBOL_SLinPrice_Risk%
(can be used for dynamic values)
buy_EURUSDi_150_0.05 = opens a buy order on EURUSD with an SL 150 points away with 5% risk if SL triggers
sell_EURUSDi_1.10200_0.03 = opens a sell order on EURUSD with an SL at 1.10200 with 3% risk if SL triggers
Close Orders
close_SYMBOL_%toClose_none
close_SYMBOL_%toClose_break
close_SYMBOL_%toClose_(price)
(can be used for dynamic values)
close_EURUSD_50_none = closes 50% of an open order and SL stays the same
close_EURUSD_0_break = closes 0% of an open order and SL moves to breakeven if trade is in profit
close_EURUSD_25_1.10200 = closes 25% of an open order and SL moves to price that is stated
Update Orders
update_SYMBOL_SL1_SL2
(can be used for dynamic values)
The logic of this command differs slightly and serves as a trailing stop between two dynamic values if your indicator provides that.
For example, if current trade is a BUY, after sending this command, it will move Stop Loss to SL1, if it’s a SELL, it will move Stop Loss to SL2.
update_EURUSDcn_1.10300_1.10100 = If we are in a BUY, Stop Loss would be updated to 1.10300. If we were in a SELL, Stop Loss would be updated to 1.10100.
If you used dynamic values in trading view, the command would essentially look like this: update_EURUSDcn_{{plot_3}}_{{plot_4}}
SEND ALERTS FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
WHY RISK MANAGEMENT?
Trading can be very lucrative, we all know that, hence; why we became traders in the first place. Whether you found an awesome indicator script on TradingView, an Expert Advisor on MT4, or whatever other strategy that got you excited about trading in the first place; you will lose no matter how perfect a strategy works.
I started trading with a strategy that had over 60% win rate and still lost half of my account. You may think I’m an idiot. I just didn’t understand it’s more important to know how much you can lose rather than how much you can make. So from now on, forget about gains. If your strategy’s win rate is above 50%, focusing on how much you can lose will always be more important. The gains will come on their own after that.
Risk management is simple and only involves basic math. So let’s start with that: To understand the calculator in it’s entirety, you must know how to calculate profit from a winning position. We’ll use a FOREX example.
Let’s say bought 1.00 Lot of EURUSD at 1.00100, a couple hours or minutes later, you closed it at 1.00200. First you subtract Close Price from Entry Price to get the amount of points you gained:
1.00200 - 1.00100 = 0.00100
100 points gain or 10 pips
To calculate dollar profit you multiply by Lot Size and multiply again by 100,000.
0.00100 * 1.00 * 100,000 = $100
Gain * Lot Size * 100,000 = $
Great, so you made $100! If your balance was $1,000, you just made 10% return, amazing! But.. what if the trade had gone wrong? How do you even calculate how much you might lose? Well first, you have to choose a Stop Loss, this varies depending on your strategy. One of my 30m strategies has a Stop Loss between 150-200 points, while a 4hr strategy might have a Stop Loss between 600-650 points.
Let’s say you’ve made up your mind and you’re going to choose a Stop Loss at 150 points, which means if price is at 1.00150, your stop loss would end up at 1.00000 on a Buy Trade. The key thing first is deciding what % of your balance you’re willing to risk. If I have $1000, you might be okay with losing 5%, which is $50. Now you use the formula above:
Gain * Lot Size * 100,000 = $
In this case, we would substitute Gain with Stop Loss value instead.
Stop Loss * Lot Size * 100,000 = $
150 * Lot Size * 100,000 = $50
As you can see, we have to solve for Lot Size because we don’t know exactly how much to trade yet if our trade hits our Stop Loss, we’ll only lose $50. I won’t go into the algebra, so here is the final formula:
Lot Size = 1 / (SL in Points / (Capital x Risk%))
Lot Size = 1 / (150 / ($1000 * 5%)) = 0.33
Trading 0.33 lot size with a hard Stop Loss of 150, we’ll only lose $50 or 5% of our balance.
That’s basic risk management, and it’ll save you headaches from losing money on your trades. Don’t worry about doing the math yourself though, use our bot that auto-calculates your position based on your risk. Happy trading!
SEND TRADES FROM TRADINGVIEW TO MT4
www.tradingviewtomt4.com
Do Robots (including Expert Advisors) work?> Robot you code yourself
-> Risk Taking
-> Market making/arbitrage
In both cases the robot will likely not be overly simple. You will need to know a thing or two about programming.
Learning to trade is like getting a degree, learning to code is like getting a second one.
-> Risk Taking
This may very well work. I do not know of anyone that does this and is profitable over more than just a few lucky months, but does not mean it does not exist. I have heard of people that tried it, even people that told me they would let me know how it went they swore they cracked it, have not heard a word since then. Also, myfxbook is full of automated systems that end up blowing up.
If it is possible, you have to monitor the market all the time, be careful about events, look for evolving conditions.
I do not see how a fully autonomous robot - you can go to holidays and come back and find money in your account - could be programmed. Would be so complex...
Are there any profitable traders that are interested in this?
-> MM & Arb
There are plenty of hft and quant firms out there. Among other things they buy order flow from Robinhood and soon other "zero commission" brokers. Old market makers that did not want to move to algos just quit and did something new.
I see them mostly as mm or parasites. They can be so anoying. I used to market make on crypto 2 years ago, the parasite would just jump in front me all the time. Any order I place he'd hop 0.0001 higher/lower. Front running bots. It's not all front running bots of course. Soros & Jim Simons (I think) run statistical arbitrage funds. Computer farms to treat a ton of data help.
It works obviously.
For stat arb you will need: Learn the basics about the market (6 month course), an intermediate programming degree (1 year), a statistics phd (8 years). Good luck.
For market making you will need: Learn a bit more than the basics about the market (1 year, don't need the speculating course), a programming degree (1 year). I am being nice with the numbers I think.
> Fully automated robot you purchase
Pros and Cons
Also,
I don't even know how it is legal, it's pretty dangerous. They sell you some fairy dust and also you get advised to "hold on" "do not be emotional with fear just hold" "be strong during drawdowns they are normal" it's actually risible.
New traders that might be a little gullible, a little greedy too will end up with some fairy dust that is guarenteed to bring their account to zero, they do not understand the markets, AND to top that, they hear that they should not panic about losses and just persevere because drawdowns are normal and they are just experiencing fear, this is what will make them lose, and this is what the robot is here to fix. "Just trust".
What you have here is a recipe for disaster.
> Robot that executes for you/semi automatic
Why not?
I see a few possible uses:
- You want to buy alot of shares of a small company long term, you set a bot to purchase some each time the stock has a strong down momentum with volume (fills you without moving the market)
- You want to sleep / take a few days off, you run an algo that will move your stop loss each time the price goes up, would not be too hard to say "use the smallest of EMA 20 0.236 ATR something else, if consolidates move closer, if price == .... then do this, ifelse the price surges then move my SL closer" etc.
- You could have a feel for the market and be very bullish, just set a bot to buy an inside bar bull break with a couple of conditions, or a pullback of a certain % but still above a certain level/MA followed by a pin bar. Sets and trails the stop loss too until you intervene because conditions have changed and you do not want to stay in or whatever reason.
- Big one: monitors correlations for you. I'd actually recommend that. A robot to warn you of your global portfolio correlation, maximum risk, and makes some recommendation (shows what are you most correlated positions making a problem, and lists stocks/currencies/futures that are uncorrelated or negatively correlated)
> Robot that alerts you
Plenty of people use that. Makes perfect sense. Something just warns you when the price does something particular or whatever. I myself mostly use trading view price alerts. I just set an alert on Bitcoin MA50 & MA200 makign a death cross, should fire up by Halloween.
I would not go overboard on this for "advanced" things, because it could get complicated, and a quick glance is even better anyway, you want to focus on what pops out "obviously", you want to see what other people are seeing on the chart.
You may want to be long on certain currencies, the bot could tell you when the price is starting a pullback...
> Indicator (sold)
There are people that dish out indicators and show people "See? Here, here, and here, my indicator fired a signal right before Bitcoin went up", and people actually get excited by it and want to purchase... And guess what? It works extremely well with crypto enthusiasts that invested in imaginary magic internet beans. Who would have thought they were gullible and dreamt of easy money fall out of the sky? The coders use the right combination of indicators, for example EMAs and candlesticks, to generate great signals IN THE PAST.
I made such an indicator myself just to show it's bollocks. I think some people still used it seriously.
Black box "predict the future" nonsense ==> Obvious scam.
So watch out for those. If you are interested in something, make sure you understand WHAT IT DOES.
Example: If the indicator provides you with order book info and idk things like this that you don't have with your broker and charting service, it obviously has value...