Closed saniales closed 6 years ago
Pinescript general reference : https://it.tradingview.com/study-script-reference
Of course functions like plot
and study
(which are inherently used by trading view for graphical purposes) can be avoided to be ported, while input
function can be substituted with input from go program (or user)
Are you proposing to re-create Pinescript in Go? If so, I think a new repository would be best.
What I was thinking was to fuse existing talib-implementation into pinescript way of code, not to directly translate pinescript itself, since pinescript has talib features built into it. I am asking here since it would inherently mean to recreate all talib functions and give them a new signature.
@markcheno let's use an example from the library
inHigh, inOpen, inClose, inLow := extractFromSomeCandles(symbol, resolution) // we can extract it from cryptocurrency exchanges as well as from forex brokers
results := talib.Security(inHigh, inOpen, inClose, inLow, talib.AvgPrice)
If you want to re-create all the functions with a different signature, I think it would be best to start a new repository.
This would allow to easily import pinescript strategies into go talib based programs
as far as I've seen, the more problematic feature is the
security
function by tradingview, which allows to switch context and have new candles and manipulate themfrom function signature (https://it.tradingview.com/study-script-reference/#fun_security) in its simplest form:
where
an example of call would be
To translate this in go-talib way I have an idea: let's create the following function
the in-arrays represent the symbol + resolution parameters results while the manipulator function will defined as follow:
In this way we would be able to use it like this:
We can also wrap manipulators one inside another, like the following:
A better way should be found though, maybe through the use of a
Wrap
function in some wayAnother idea would be to create a ContextSwitcher function which is like the following
@markcheno what do you think? is it possible in your opinion. In case it's not I can create a separate repo, detaching from talib