PINE LIBRARY
azLibKnn - PV

Library "azLibKnn"
Provides functions to use a classification algorithm (KNN) to make classifications or predictions about the grouping of an individual data point.
featurize(src, flb, clb)
Adapts the given source into a KNN Feature based on the feature and classification lookback settings.
Parameters:
src: (series float) Source. The value series to calculate the feature from.
flb: (simple int) Optional. Feature Lookback. Specify how many periods to include from the source series. Default is 1.
clb: (simple int) Optional. Classification Lookback. Specify which periods to include from the source series. Default is 1.
Returns: (series float) Calculated feature value. In this case the average source value in the feature lookback period.
classify(srcOpen, srcClose, clb, cb, summarize)
Get calculated classification from given open and close price sources based on classification lookback and base settings.
Parameters:
srcOpen: (series float) Source Open Prices. The open price series to be used in the classification calculation.
srcClose: (series float) Source Close Prices. The close price series to be used in the classification calculation.
clb: (simple int) Optional. Classification Lookback. Specify which periods to include from the source series. Default is 1.
cb: (simple string) Optional. Classification Base. Specify how to calculate the classification. Default is 'PRICEDIFF'.
summarize: (simple bool) Optional. Summarize. Specify if the classification needs to be summarized to 0 (NEUTRAL), 1 (BULL), -1 (BEAR) or that the raw classification value needs to be used. Default is false (raw value).
Returns: (series float) Calculated (optionally summarized) classification value.
train(features1, features2, classifications, f1, f2, c, max, maxMode)
Stores the combination of features and classification to the KNN Model.
Parameters:
features1: (series array<float>) Id of Features 1 array.
features2: (series array<float>) Id of Features 2 array.
classifications: (series array<float>) Id of Classifications array.
f1: (series float) New Feature 1 value to add to the model.
f2: (series float) New Feature 2 value to add to the model.
c: (series float) New Classification value to add to the model.
max: (simple int) Optional. Specify the maximum model size. Default is 240.
maxMode: (simple string) Optional. Specifies the mode to use when the model reaches the maximum size. Default is FIFO.
predict(features1, features2, classifications, p1, p2, k)
Make a prediction based on parameter 1 and parameter 2, finding k nearest neighbours and use their classifications
Parameters:
features1: (series array<float>) Id of Features 1 array.
features2: (series array<float>) Id of Features 2 array.
classifications: (series array<float>) Id of Classifications array.
p1: (series float) Parameter 1 value to calculate distances from.
p2: (series float) Parameter 2 value to calculate distances from.
k: (simple int) Optional. Specify k nearest neighbours. Use odd value to avoid draw decissions. Default is 27.
Provides functions to use a classification algorithm (KNN) to make classifications or predictions about the grouping of an individual data point.
featurize(src, flb, clb)
Adapts the given source into a KNN Feature based on the feature and classification lookback settings.
Parameters:
src: (series float) Source. The value series to calculate the feature from.
flb: (simple int) Optional. Feature Lookback. Specify how many periods to include from the source series. Default is 1.
clb: (simple int) Optional. Classification Lookback. Specify which periods to include from the source series. Default is 1.
Returns: (series float) Calculated feature value. In this case the average source value in the feature lookback period.
classify(srcOpen, srcClose, clb, cb, summarize)
Get calculated classification from given open and close price sources based on classification lookback and base settings.
Parameters:
srcOpen: (series float) Source Open Prices. The open price series to be used in the classification calculation.
srcClose: (series float) Source Close Prices. The close price series to be used in the classification calculation.
clb: (simple int) Optional. Classification Lookback. Specify which periods to include from the source series. Default is 1.
cb: (simple string) Optional. Classification Base. Specify how to calculate the classification. Default is 'PRICEDIFF'.
summarize: (simple bool) Optional. Summarize. Specify if the classification needs to be summarized to 0 (NEUTRAL), 1 (BULL), -1 (BEAR) or that the raw classification value needs to be used. Default is false (raw value).
Returns: (series float) Calculated (optionally summarized) classification value.
train(features1, features2, classifications, f1, f2, c, max, maxMode)
Stores the combination of features and classification to the KNN Model.
Parameters:
features1: (series array<float>) Id of Features 1 array.
features2: (series array<float>) Id of Features 2 array.
classifications: (series array<float>) Id of Classifications array.
f1: (series float) New Feature 1 value to add to the model.
f2: (series float) New Feature 2 value to add to the model.
c: (series float) New Classification value to add to the model.
max: (simple int) Optional. Specify the maximum model size. Default is 240.
maxMode: (simple string) Optional. Specifies the mode to use when the model reaches the maximum size. Default is FIFO.
predict(features1, features2, classifications, p1, p2, k)
Make a prediction based on parameter 1 and parameter 2, finding k nearest neighbours and use their classifications
Parameters:
features1: (series array<float>) Id of Features 1 array.
features2: (series array<float>) Id of Features 2 array.
classifications: (series array<float>) Id of Classifications array.
p1: (series float) Parameter 1 value to calculate distances from.
p2: (series float) Parameter 2 value to calculate distances from.
k: (simple int) Optional. Specify k nearest neighbours. Use odd value to avoid draw decissions. Default is 27.
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
🔗 Explore and learn about connectable indicators on Azullian: azullian.com
🔗 Check out how it works: youtu.be/gPNz0XiZl38
🔗 Strategy plus demo: youtu.be/jRpvt_ZdIOg
🔗 Join our discord: discord.com/invite/vT7AqmE
🔗 Check out how it works: youtu.be/gPNz0XiZl38
🔗 Strategy plus demo: youtu.be/jRpvt_ZdIOg
🔗 Join our discord: discord.com/invite/vT7AqmE
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
Pine腳本庫
秉持 TradingView 一貫的共享精神,作者將此 Pine 程式碼發佈為開源庫,讓社群中的其他 Pine 程式設計師能夠重複使用。向作者致敬!您可以在私人專案或其他開源發佈中使用此庫,但在公開發佈中重複使用該程式碼需遵守社群規範。
🔗 Explore and learn about connectable indicators on Azullian: azullian.com
🔗 Check out how it works: youtu.be/gPNz0XiZl38
🔗 Strategy plus demo: youtu.be/jRpvt_ZdIOg
🔗 Join our discord: discord.com/invite/vT7AqmE
🔗 Check out how it works: youtu.be/gPNz0XiZl38
🔗 Strategy plus demo: youtu.be/jRpvt_ZdIOg
🔗 Join our discord: discord.com/invite/vT7AqmE
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。