### Get Wine Installation Path Source: https://docs.pineconnector.com/metatrader-5-mac Execute this command to determine the installation path of Wine. The output should be a specific directory like /usr/local/bin/wine or /opt/homebrew/bin/wine. ```bash which wine ``` -------------------------------- ### Run MT5 Installer with Wine Source: https://docs.pineconnector.com/metatrader-5-mac Navigate to the directory where the MT5 installer (.exe) was downloaded and execute it using Wine. This command assumes you are in the Downloads directory. ```bash cd Downloads wine mt5setup.exe ``` -------------------------------- ### Expectancy Calculation Example Source: https://docs.pineconnector.com/analytics An example demonstrating the calculation of system expectancy with specific values for win rate, loss rate, average win, and average loss. ```mathematics Expectancy=40−30=10 ``` -------------------------------- ### Verify Wine Installation Source: https://docs.pineconnector.com/metatrader-5-mac Run this command in the terminal to check if Wine is installed correctly. It should output the installed version number. ```bash wine --version ``` -------------------------------- ### Spread Filter Example (Float) Source: https://docs.pineconnector.com/syntax Allows an entry order only if the current market spread is less than or equal to 1.22 pips. ```csv LicenseID,buy,EURUSD,vol_lots=1,spread=1.22 ``` -------------------------------- ### Spread Filter Example (Integer) Source: https://docs.pineconnector.com/syntax Allows an entry order only if the current market spread is less than or equal to 2 pips. ```csv LicenseID,buy,EURUSD,vol_lots=1,spread=2 ``` -------------------------------- ### Example Signal Format Source: https://docs.pineconnector.com/enterprise This is the format for sending signals to your License ID. The signal includes the action, symbol, and risk/stop loss/take profit parameters. ```text buy, EURUSD, risk=1, sl=10, tp=20 ``` -------------------------------- ### Configure Aether Plugin with Environment Variables Source: https://docs.pineconnector.com/documentation Example of configuring an Aether plugin in aether-config.js, using an API key loaded from environment variables. ```javascript require("dotenv").config({ path: ".env.${process.env.NODE_ENV}", }) module.exports = { plugins: [ { resolve: "`aether`", options: { apiKey: process.env.API_KEY, }, }, ], } ``` -------------------------------- ### Strategy 2 Entry Signal Source: https://docs.pineconnector.com/multi-strategy Example of an entry signal for Strategy 2, using the same format as Strategy 1 but with a different comment identifier. ```text LicenseID,buy,EURUSD,risk=1,comment=strategy 2 ``` -------------------------------- ### Example PineConnector Alert Message Source: https://docs.pineconnector.com/test-alert An example of a buy order for EURUSD with a volume of 1 lot. Replace '6161199464661' with your actual License ID. ```text 6161199464661,buy,EURUSD,vol_lots=1 ``` -------------------------------- ### Example Calculation of Expectancy in Percentage Source: https://docs.pineconnector.com/metrics Demonstrates the calculation of trading expectancy in percentage terms using a Reward-to-Risk Ratio of 2 and a Win Ratio of 40%. ```plaintext Expectancy (%) = (0.4 * 2) - (1 - 0.4) = 0.8 - 0.6 = 0.2 or 20% ``` -------------------------------- ### Pip Trailing Parameters Example Source: https://docs.pineconnector.com/syntax Includes trailtrig, traildist, and trailstep for activating and adjusting a trailing stop-loss based on pip movements. Ensure all three parameters are present for pip trailing. ```csv LicenseID,buy,EURUSD,vol_lots=1,trailtrig=12,traildist=8,trailstep=3 ``` -------------------------------- ### Strategy 1 Entry Signal Source: https://docs.pineconnector.com/multi-strategy Example of an entry signal for Strategy 1, including the license ID, command, instrument, risk, and a specific comment identifier. ```text LicenseID,buy,EURUSD,risk=1,comment=strategy 1 ``` -------------------------------- ### Example Calculation of Expectancy in Dollars Source: https://docs.pineconnector.com/metrics Shows how to calculate trading expectancy in dollar terms, given a Reward-to-Risk Ratio of 2, a Win Ratio of 40%, and an Average Loss of $100. ```plaintext Expectancy ($) = [(0.4 * 2) - (1 - 0.4)] * 100 = [0.8 - 0.6] * 100 = 0.2 * 100 = $20 ``` -------------------------------- ### PineScript Version Declaration Source: https://docs.pineconnector.com/low-code Declare the PineScript version at the beginning of your script. This example uses version 5. ```PineScript //@version=5 ``` -------------------------------- ### Add Wine to PATH (if not found) Source: https://docs.pineconnector.com/metatrader-5-mac If 'wine --version' returns 'command not found' after installation, use this command to add Wine to your PATH environment variable and then re-run 'wine --version'. ```bash echo export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc source ~/.zshrc ``` -------------------------------- ### Complete Strategy Script with Visual Confirmation Source: https://docs.pineconnector.com/low-code This is a full example of a TradingView strategy script incorporating the Supertrend indicator and PineConnector's visual buy/sell signals. It demonstrates how to integrate entry conditions with plotshape for enhanced visualization. ```pine //@version=5 strategy('Supertrend Strategy', overlay=true) [supertrend, direction] = ta.supertrend(3, 10) bodyMiddle = plot((open + close) / 2, display=display.none) upTrend = plot(direction < 0 ? supertrend : na, 'Up Trend', color=color.new(color.green, 0), style=plot.style_linebr) downTrend = plot(direction < 0 ? na : supertrend, 'Down Trend', color=color.new(color.red, 0), style=plot.style_linebr) fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false) fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false) if ta.change(direction) < 0 strategy.entry('My Long Entry Id', strategy.long) if ta.change(direction) > 0 strategy.entry('My Short Entry Id', strategy.short) plotshape(ta.change(direction) < 0, style=shape.labelup, location=location.belowbar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector Buy', textcolor=color.new(color.white, 0)) //plotting up arrow when buy/long conditions met plotshape(ta.change(direction) > 0, style=shape.labeldown, location=location.abovebar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector Sell', textcolor=color.new(color.white, 0)) //plotting down arrow when sell/short conditions met ``` -------------------------------- ### ATR Trailing Parameters Example Source: https://docs.pineconnector.com/syntax Includes atrtimeframe and atrperiod for calculating ATR-based trailing stop-loss. Other parameters like atrmultiplier, atrshift, and atrtrigger have default values if omitted. ```csv LicenseID,buy,EURUSD,vol_lots=1,sl_pips=10, atrtimeframe=60,atrperiod=14,atrmultiplier=2,atrtrigger=8 ``` -------------------------------- ### Integrated Script with Visual Cues Source: https://docs.pineconnector.com/low-code This example shows a complete TradingView Pine Script integrating EMA indicators, crossover/crossunder logic for long and short entries, and plotshape functions for visual buy/sell signals. Replace 'long' and 'short' with your specific entry conditions. ```pinescript //@version=5 indicator("EMA", overlay=true) ema20 = ta.ema(close,20) ema50 = ta.ema(close,50) plot(ema20, color=color.new(color.blue, 5)) plot(ema50, color=color.new(color.red, 5)) long = ta.crossover(ema20, ema50) and close > ema20 short = ta.crossunder(ema20, ema50) and close < ema20 plotshape(long, style=shape.labelup, location=location.belowbar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector Buy', textcolor=color.new(color.white, 0)) //plotting up arrow when buy/long conditions met plotshape(short, style=shape.labeldown, location=location.abovebar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector Sell', textcolor=color.new(color.white, 0)) //plotting down arrow when sell/short conditions met ``` -------------------------------- ### Sample Alert Messages for PineConnector Source: https://docs.pineconnector.com/syntax These examples demonstrate various PineConnector-compliant alert messages, including buying with specific lot sizes, selling with a secret key, selling with risk defined in dollars and stop-loss in pips, and closing a trade. ```text 60123456789,buy,AUDUSD,vol_lots=0.1 ``` ```text 60123456789,sell,EURUSD,vol_lots=1, secret=HappyTrader501 ``` ```text 60123456789,sell,GBPJPY,vol_dollar=50,sl_pips=20 ``` ```text 60123456789,closelong,GBPUSD ``` -------------------------------- ### Cancel Long Buylimit and Open New Buy Limit Source: https://docs.pineconnector.com/syntax Cancels all pending Buy orders and places a new Buy Limit order. Example shows entry at exact price with specified stop loss price and volume in dollar. ```text // Cancels old buys, places new Buy Limit at exact price LicenseID, cancellongbuylimit, EURUSD, entry_price=1.0500, sl_price=1.0450, vol_dollar=100 ``` -------------------------------- ### Cancel Short Selllimit and Open New Sell Limit Source: https://docs.pineconnector.com/syntax Cancels all pending Sell orders and places a new Sell Limit order. Example shows entry 15 pips above market with take profit 50 pips away and volume as percentage of balance loss. ```text // Cancels old sells, places new Sell Limit 15 pips above market LicenseID, cancelshortselllimit, EURUSD, entry_pips=15, tp_pips=50, vol_pct_bal_loss=1 ``` -------------------------------- ### Cancel Long Buystop and Open New Buy Stop Source: https://docs.pineconnector.com/syntax Cancels all pending Buy orders and places a new Buy Stop order. Example shows entry 10 pips above market with stop loss 20 pips away. ```text // Cancels old buys, places new Buy Stop 10 pips above market LicenseID, cancellongbuystop, EURUSD, entry_pips=10, sl_pips=20, vol_lots=0.5 ``` -------------------------------- ### Import PineConnector DLLs and EA Source: https://docs.pineconnector.com/metatrader-5-mac Move the downloaded PineConnector DLL and EA files to the appropriate MetaTrader 5 MQL5 Experts directory within the Wine environment. Ensure the paths are correct for your system. ```bash mv ~/Downloads/PineConnector/PineConnector-MT5-DLL-v1.17.dll ~/Downloads/PineConnector/PineConnector-MT5-EA-v3.45.ex5 ~/.wine/drive_c/Program\ Files/MetaTrader\ 5/MQL5/Experts/ ``` -------------------------------- ### Webhook URL with License ID and Buy Command Source: https://docs.pineconnector.com/syntax This is a sample webhook URL to be pasted into TradingView alert settings. It includes the License ID, a buy command, the currency pair, and specifies the volume in lots. ```text LicenseID,buy,EURUSD,vol_lots=1 ``` -------------------------------- ### Indicator Script Declaration Source: https://docs.pineconnector.com/low-code Declare a script as an indicator. This example names the indicator 'AlphaTrend - PineConnector' and sets it to overlay on the chart. ```PineScript //@version=5 indicator('AlphaTrend - PineConnector', overlay=true) ``` -------------------------------- ### Strategy Script Declaration Source: https://docs.pineconnector.com/low-code Declare a script as a strategy. This example names the strategy 'Supertrend Strategy - PineConnector' and sets it to overlay on the chart. ```PineScript //@version=5 strategy('Supertrend Strategy - PineConnector', overlay=true) ``` -------------------------------- ### Correct Syntax for Trigger Parameters Source: https://docs.pineconnector.com/trigger Demonstrates acceptable and unacceptable syntax for trigger parameters, focusing on trailing commas and accidental inclusions. ```text LicenseID,buy,EURUSD,risk=1,sl=5} (not acceptable) LicenseID,buy,EURUSD,risk=1,sl=5, (not acceptable) LicenseID,buy,EURUSD,risk=1,sl=5 (acceptable) ``` -------------------------------- ### Set Risk as Percentage of Equity Loss Source: https://docs.pineconnector.com/syntax Use `vol_pct_eq_loss=` to calculate lot size based on a percentage of your account equity (Balance ± Open Floating P/L). A Stop-Loss parameter is required. ```text LicenseID,buy,US30,vol_pct_eq_loss=1,sl_pips=50 ``` -------------------------------- ### Cancel Short Sellstop and Open New Sell Stop Source: https://docs.pineconnector.com/syntax Cancels all pending Sell orders and places a new Sell Stop order. Example shows entry 0.5% below market with stop loss percentage and volume in lots. ```text // Cancels old sells, places new Sell Stop 0.5% below market LicenseID, cancelshortsellstop, EURUSD, entry_pct=0.5, sl_pct=0.5, vol_lots=1 ``` -------------------------------- ### Set Risk as Percentage of Balance Loss Source: https://docs.pineconnector.com/syntax Use `vol_pct_bal_loss=` to calculate lot size based on a percentage of your account balance that you are willing to lose. A Stop-Loss parameter is required. ```text LicenseID,sell,EURUSD,vol_pct_bal_loss=1,sl_pips=10 ``` -------------------------------- ### Set Take-Profit by Percentage Source: https://docs.pineconnector.com/syntax Sets the Take-Profit a percentage distance away from the entry price. For buy orders, it's Entry Price * (1 + Percentage). For sell orders, it's Entry Price * (1 - Percentage). ```text LicenseID,buy,SOLUSD,vol_lots=1,tp_pct=5 ``` -------------------------------- ### Basic Static Alert Source: https://docs.pineconnector.com/low-code-intermediate Creates a simple alert with static symbol and risk values. Use `alert.freq_once_per_bar_close` to minimize repainting. ```pinescript alert('LicenseID,buy,EURUSD,risk=1', alert.freq_once_per_bar_close) ``` -------------------------------- ### Close Short, Open Short Source: https://docs.pineconnector.com/syntax Closes all open sell positions and opens a new sell market order. Volume parameter is required. Short form CS+OS is accepted. ```text LicenseID,closeshortopenshort,EURUSD,risk=1 ``` ```text LicenseID,CS+OS,EURUSD,risk=1 ``` -------------------------------- ### Place Buy Limit Order with Specific Price Entry Source: https://docs.pineconnector.com/syntax Use this snippet to place a Buy Limit order at an exact price level. It specifies the entry price, stop-loss in pips, and volume in lots. ```text LicenseID, buylimit, EURUSD, entry_price=1.07250, sl_pips=30, vol_lots=1 ``` -------------------------------- ### Static Alert with SL and TP Parameters Source: https://docs.pineconnector.com/low-code-intermediate Extends the basic alert by including static stop-loss (sl) and take-profit (tp) parameters. ```pinescript alert('LicenseID,buy,EURUSD,risk=1,sl=10,tp=20', alert.freq_once_per_bar_close) ``` -------------------------------- ### Close Long and Short, Open Short Source: https://docs.pineconnector.com/syntax Closes all open buy and sell positions and opens a new sell market order. Volume parameter is required. Short form CLS+OS is accepted. ```text LicenseID,closelongshortopenshort,EURUSD,risk=1 ``` ```text LicenseID,CLS+OS,EURUSD,risk=1 ``` -------------------------------- ### Close Long, Open Short Source: https://docs.pineconnector.com/syntax Closes all open buy positions and opens a new sell market order. Volume parameter is required. Short form CL+OS is accepted. ```text LicenseID,closelongopenshort,EURUSD,vol_lots=1 ``` ```text LicenseID,CL+OS,EURUSD,vol_lots=1 ``` -------------------------------- ### Add Sell Alert to Strategy Source: https://docs.pineconnector.com/low-code Inject this code near strategy.entry for short positions to trigger a sell alert. Remember to replace 'LicenseID' with your actual license ID. ```pine alert('LicenseID,sell,EURUSD,risk=1', alert.freq_once_per_bar_close) ``` -------------------------------- ### MACD Strategy Implementation Source: https://docs.pineconnector.com/macd-strategy This script implements the MACD strategy with PineConnector for automated trading. It includes inputs for license ID, risk management, and MACD parameters. Alerts are configured to send buy/sell signals to PineConnector EA. ```pine //@version=5 strategy("MACD Strategy - PineConnector", overlay=true) LicenseID = 6914107867349 // 1. change to your PineConnector License ID (required) riskvalue = input.int(1, 'Risk Value') // 2. Change the risk value (optional) slvalue = input.int(500, 'Sl Value') // 3. Change the sl value (optional) tpvalue = input.int(1000, 'TP Value') // 4. Change the tp value (optional) fastLength = input(34) // 5. Change the fastlength (optional) slowlength = input(90) // 6. Change the slowlength (optional) MACDLength = input(144) // 7. Change the MACDlength (optional) MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength) aMACD = ta.ema(MACD, MACDLength) delta = MACD - aMACD MacdBuy = ta.crossover(delta, 0) MacdSell = ta.crossunder(delta, 0) plotshape(MacdBuy, style=shape.labelup, location=location.belowbar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector \n Buy', textcolor=color.new(color.white, 0)) //plotting up arrow when buy/long conditions met plotshape(MacdSell, style=shape.labeldown, location=location.abovebar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector \n Sell', textcolor=color.new(color.white, 0)) //plotting down arrow when sell/short conditions met if (ta.crossover(delta, 0)) strategy.entry("MacdBuy", strategy.long, comment="MacdBuy") alert(str.tostring(LicenseID)+',buy,' + syminfo.ticker + ',risk=' + str.tostring(riskvalue)+ ',sl=' + str.tostring(slvalue)+ ',tp=' + str.tostring(tpvalue), alert.freq_once_per_bar_close) if (ta.crossunder(delta, 0)) strategy.entry("MacdSell", strategy.short, comment="MacdSell") alert(str.tostring(LicenseID)+',sell,' + syminfo.ticker + ',risk=' + str.tostring(riskvalue)+ ',sl=' + str.tostring(slvalue)+ ',tp=' + str.tostring(tpvalue), alert.freq_once_per_bar_close) ``` -------------------------------- ### Add Alert Function for Buy/Sell Signals Source: https://docs.pineconnector.com/low-code Implement alert functions to trigger notifications when entry conditions are met. Replace 'LongEntryCondition' and 'ShortEntryCondition' with your specific logic, and update 'LicenseID', currency pair, and risk parameters as needed. ```pinescript if LongEntryCondition alert('LicenseID,buy,EURUSD,risk=1', alert.freq_once_per_bar_close) if ShortEntryCondition alert('LicenseID,sell,EURUSD,risk=1', alert.freq_once_per_bar_close) ``` -------------------------------- ### EMA Crossover Strategy with Alerts Source: https://docs.pineconnector.com/low-code-intermediate This script calculates and plots two EMAs, identifies crossover conditions for long and short signals, and plots shapes to visualize these signals. It also includes logic to dynamically adjust the symbol for NAS100 and triggers multiple alerts with dynamic stop-loss, take-profit, and risk values for different license IDs. ```pine //@version=5 indicator("EMA", overlay=true) ema20 = ta.ema(close,20) ema50 = ta.ema(close,50) plot(ema20, color=color.new(color.blue, 5)) plot(ema50, color=color.new(color.red, 5)) long = ta.crossover(ema20, ema50) and close > ema20 short = ta.crossunder(ema20, ema50) and close < ema20 //plotting arrows to print entries on the chart plotshape(long, style=shape.labelup, location=location.belowbar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector \n Buy', textcolor=color.new(color.white, 0)) //plotting up arrow when buy/long conditions met plotshape(short, style=shape.labeldown, location=location.abovebar, color=color.new(#046ff9, 0), size=size.large, text='PineConnector \n Sell', textcolor=color.new(color.white, 0)) //plotting down arrow when sell/short conditions met //manipulating symbol to NAS100 if ticker is US100 symbol = syminfo.ticker if syminfo.ticker == "US100" symbol := "NAS100" //variables to store dynamic values LongSL = low[1] LongTP = ta.ema(close,50) RiskValue = 1 //trigger 3 alerts to the various License IDs with dynamic syntax if long alert('LicenseID1,buy,' +symbol+ ',sl=' +str.tostring(LongSL)+ ',tp=' +str.tostring(LongTP)+ ',risk='+str.tostring(RiskValue), alert.freq_once_per_bar_close) alert('LicenseID2,buy,' +symbol+ ',sl=' +str.tostring(LongSL)+ ',tp=' +str.tostring(LongTP)+ ',risk='+str.tostring(RiskValue), alert.freq_once_per_bar_close) alert('LicenseID3,buy,' +symbol+ ',sl=' +str.tostring(LongSL)+ ',tp=' +str.tostring(LongTP)+ ',risk='+str.tostring(RiskValue), alert.freq_once_per_bar_close) ``` -------------------------------- ### Close on Reverse - Strategy 1 Exit/Reverse Source: https://docs.pineconnector.com/multi-strategy Command to close the buy position for Strategy 1 and open a sell position, demonstrating the 'Close on Reverse' functionality. ```text LicenseID,sell,EURUSD,risk=1,comment=strategy 1 ```