Code Adapter
Converting your Pinescript code to be PineConnector compatible, automatically!
Assuming basic code of:
The output should be:
There are 2 components that needs to be added:
- the alert() code that comes a row after “strategy.entry”
- if strategy.entry has “strategy.long” →
alert('60123456789,buy,EURUSD,risk=1', alert.freq_once_per_bar_close) - if strategy.entry has “strategy.short” →
alert('60123456789,sell,EURUSD,risk=1', alert.freq_once_per_bar_close) - plotshape() code that uses the entry condition → this usually comes after the “if” such as “ta.change(direction) > 0”
- since “ta.change(direction) < 0” comes after the “if” and “strategy.long” was used → code to add for arrow up:
- since “ta.change(direction) > 0” comes after the “if” and “strategy.short” was used → code to add for arrow down:
plotshape(ta.change(direction) < 0, 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(ta.change(direction) > 0, 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
We may use placeholders for now, and we can refine the exact code to use in later versions.
The above is to be done using HTML, CSS and JS.
Essentially, we are trying to automate “Section 1.2 Strategy” in the documentation here: https://docs.pineconnector.com/low-code#445e8f8d8c9e48c39adf9d2e64bf7a92