FunctionNNPerceptronLibrary "FunctionNNPerceptron"
Perceptron Function for Neural networks.
function(inputs, weights, bias, activation_function, alpha, scale) generalized perceptron node for Neural Networks.
Parameters:
inputs : float array, the inputs of the perceptron.
weights : float array, the weights for inputs.
bias : float, default=1.0, the default bias of the perceptron.
activation_function : string, default='sigmoid', activation function applied to the output.
alpha : float, default=na, if required for activation.
scale : float, default=na, if required for activation.
@outputs float
Machinelearning
MLActivationFunctionsLibrary "MLActivationFunctions"
Activation functions for Neural networks.
binary_step(value) Basic threshold output classifier to activate/deactivate neuron.
Parameters:
value : float, value to process.
Returns: float
linear(value) Input is the same as output.
Parameters:
value : float, value to process.
Returns: float
sigmoid(value) Sigmoid or logistic function.
Parameters:
value : float, value to process.
Returns: float
sigmoid_derivative(value) Derivative of sigmoid function.
Parameters:
value : float, value to process.
Returns: float
tanh(value) Hyperbolic tangent function.
Parameters:
value : float, value to process.
Returns: float
tanh_derivative(value) Hyperbolic tangent function derivative.
Parameters:
value : float, value to process.
Returns: float
relu(value) Rectified linear unit (RELU) function.
Parameters:
value : float, value to process.
Returns: float
relu_derivative(value) RELU function derivative.
Parameters:
value : float, value to process.
Returns: float
leaky_relu(value) Leaky RELU function.
Parameters:
value : float, value to process.
Returns: float
leaky_relu_derivative(value) Leaky RELU function derivative.
Parameters:
value : float, value to process.
Returns: float
relu6(value) RELU-6 function.
Parameters:
value : float, value to process.
Returns: float
softmax(value) Softmax function.
Parameters:
value : float array, values to process.
Returns: float
softplus(value) Softplus function.
Parameters:
value : float, value to process.
Returns: float
softsign(value) Softsign function.
Parameters:
value : float, value to process.
Returns: float
elu(value, alpha) Exponential Linear Unit (ELU) function.
Parameters:
value : float, value to process.
alpha : float, default=1.0, predefined constant, controls the value to which an ELU saturates for negative net inputs. .
Returns: float
selu(value, alpha, scale) Scaled Exponential Linear Unit (SELU) function.
Parameters:
value : float, value to process.
alpha : float, default=1.67326324, predefined constant, controls the value to which an SELU saturates for negative net inputs. .
scale : float, default=1.05070098, predefined constant.
Returns: float
exponential(value) Pointer to math.exp() function.
Parameters:
value : float, value to process.
Returns: float
function(name, value, alpha, scale) Activation function.
Parameters:
name : string, name of activation function.
value : float, value to process.
alpha : float, default=na, if required.
scale : float, default=na, if required.
Returns: float
derivative(name, value, alpha, scale) Derivative Activation function.
Parameters:
name : string, name of activation function.
value : float, value to process.
alpha : float, default=na, if required.
scale : float, default=na, if required.
Returns: float
MLLossFunctionsLibrary "MLLossFunctions"
Methods for Loss functions.
mse(expects, predicts) Mean Squared Error (MSE) " MSE = 1/N * sum ((y - y')^2) ".
Parameters:
expects : float array, expected values.
predicts : float array, prediction values.
Returns: float
binary_cross_entropy(expects, predicts) Binary Cross-Entropy Loss (log).
Parameters:
expects : float array, expected values.
predicts : float array, prediction values.
Returns: float
M.Right Awesome RSI+ (cc)Hey Traders,
Tonight I figured I'd release a special indicator that I've had in the works for years and finally was able to piece it together using pine. It's an extremely accurate take on the RSI. I plan to continue to refine the indicator and add more features, but as it is this is still one you can make a lot of money with.
(((((Please note: all circles and arrows in the chart above are drawn for illustration. Below is a chart showing regular session)))))
This indicator will act similarly to a regular RSI (Relative Strength Indicator) in that there are Oversold and Overbought levels, but also volatility bands around it to allow for more accurate signals whilst moving the Oversold (OS) and Overbought (OB) levels further apart ( less false OB/OS signals ). As shown in the chart above, it's able to detect some pretty big moves with both speed and accuracy .
Most of you are familiar with and use an RSI indicator so I will keep this description as brief as possible: The Relative Strength Index (RSI), developed by the legendary J. Welles Wilder, is a momentum oscillator that measures the speed and change of price movements; it oscillates between 0 - 100, with levels set as Overbought and Oversold. These levels are where a trader make look for a reversal, however they must keep in mind in an uptrend or bull market, the RSI tends to remain in the 40 - 90 range; 40 - 50 zone often will act as support. More advanced traders will also look for divergences between the price and the oscillator (i.e. price trending upward while oscillator trending downward). As far as oscillators go, the RSI is one of the most frequently used, by both advanced and beginner traders alike.
Works great on multiple timeframes. It may not catch every rally, but it will catch most --even on smaller timeframes (i.e. 5 minutes in image below).
As with all of my scripts I like to make them customizable:
You can change the up and down colors on the RSI ribbons and the color and style (dotted shown) of Overbought / Oversold lines. In future versions, I will add more color customizations and additions.
Can toggle 1 or both of the 2 highlight signals off to make it a little more plain.
Lot's of ways to make it look the way you'd like it to.
--The alerts include both the super accurate Bullish and Bearish signals shown with the background highlights. They are pre-filled so it will automatically display the price and time that the alert went off for you.
If I missed anything or you have a question, please let me know!
Cheers,
Mike
Please note: I have made this indicator invite only, send me a DM if you're interested in trying it out.
CryptoNite - Machine Learning Strategy (15Min Timeframe)Greeting Traders! I am back with another ML strategy. :D I kept my word with combining my machine learning algorithms from Python and integrating them into Tradingview. Thanks to Tradingview's new release of Pinescript v5 it is now possible. This strategy respects the Sortino Ratio and was created using 2 years of data for 50 different cryptocurrencies. That is a total of 100 years of data and 44,849 trades to create this strategy. Now let me tell you, my computer and I are exhausted. We both been at it non-stop for about two months everyday. I refine the strategy, and the computer runs 24/7 for a few days to spit out the best results into the terminal. It's been a good run so my computer will finally get some sleep tonight.
So let's talk a little about the features of the strategy. In the settings window, you'll see the Stoploss, Take Profit Parameters, and Date Range. You can change the Date Range, but I recommend to leave the SL/TP parameters how they are because the machine learning algo chose those input. If you wish to change them you are always welcome to do so but backtest results will change. For the Take Profit parameters you'll see on the left side you something labeled time duration(displayed in minutes) and on the right side you'll see take profit values. Let's talk a little bit how they work.
TP_values = {
"0": 0.102,
"133": 0.051,
"431": 0.039,
"963": 0
}
In python, the table looks like this but it is quite easy to understand in Tradingview.
From 0-133 minutes, the strategy is looking to the reach target point 1 at 10.2% profit.
From 133-431 minutes, the strategy is looking to the reach target point 2 at 5.1% profit.
From 431-963 minutes, the strategy is looking to the reach target point 3 at 3.9% profit.
From 963+ minutes, the strategy is looking to break even at 0% profit on target point 4.
Through each target point a sell trigger is active. It will look for the best time to sell even if TP has not been reached.
This helps the trade not stay open too long.
The last thing I need to mention is the textbox displayed on the right side of your chart. This textbox displays the current Take Profit value in dollar amount. So when you're in a trade you'll know what TP target has to be reached when the open trade is active. Throughout time, the target price changes depending how long the trade has been open. If you have any questions feel free to comment down below, and enjoy this strategy!
Financial Astrology Indexes ML Daily TrendDaily trend indicator based on financial astrology cycles detected with advanced machine learning techniques for some of the most important market indexes: DJI, UK100, SPX, IBC, IXIC, NI225, BANKNIFTY, NIFTY and GLD fund (not index) for Gold predictions. The daily price trend is forecasted through planets cycles (angular aspects, speed phases, declination zone), fast cycles are based on Moon, Mercury, Venus and Sun and Mid term cycles are based on Mars, Vesta and Ceres . The combination of all this cycles produce a daily price trend prediction that is encoded into a PineScript array using binary format "0 or 1" that represent sell and buy signals respectively. The indicator provides signals since 2021-01-01 to 2022-12-31, the past months signals purpose is to support backtesting of the indicator combined with other technical indicator entries like MAs, RSI or Stochastic . For future predictions besides 2022 a machine learning models re-train phase will be required.
When the signal moving average is increasing from 0 to 1 indicates an increase of buy force, when is decreasing from 1 to 0 indicates an increase in sell force, finally, when is sideways around the 0.4-0.6 area predicts a period of buy/sell forces equilibrium, traders indecision which result in a price congestion within a narrow price range.
We also have published same indicator for Crypto-Currencies research portfolio:
DISCLAIMER: This indicator is experimental and don’t provide financial or investment advice, the main purpose is to demonstrate the predictive power of financial astrology. Any allocation of funds following the documented machine learning model prediction is a high-risk endeavour and it’s the users responsibility to practice healthy risk management according to your situation.
Financial Astrology Crypto ML Daily TrendThis daily trend indicator is based on financial astrology cycles detected with advanced machine learning techniques for the crypto-currencies research portfolio: ADA, BAT, BNB, BTC, DASH, EOS, ETC, ETH, LINK, LTC, XLM, XMR, XRP, ZEC and ZRX. The daily price trend is forecasted through this planets cycles (angular aspects, speed, declination), fast ones are based on Moon, Mercury, Venus and Sun and Mid term cycles are based on Mars, Vesta and Ceres. The combination of all this cycles produce a daily price trend prediction that is encoded into a PineScript array using binary format "0 or 1" that represent sell and buy signals respectively. The indicator provides signals since 2021-01-01 to 2022-12-31, the past months signals purpose is to support backtesting of the indicator combined with other technical indicator entries like MAs, RSI or Stochastic. For future predictions besides 2022 a machine learning models re-train phase will be required.
The resolution of this indicator is 1D, you can tune a parameter where you can determine how many future bars of daily trend are plotted and adjust an hours shift to anticipate future signals into current bar in order to produce a leading indicator effect to anticipate the trend changes with some hours of anticipation. Combined with technical analysis indicators this daily trend is very powerful because can help to produce approximately 60% of profitable signals based on the backtesting results. You can look at our open source Github repositories to validate accuracy using the backtesting strategies we have implemented in Jesse Crypto Trading Framework as proof of concept of the predictive potential of this indicator. Alternatively, we have implemented a PineScript strategy that use this indicator, just consider that we are pending to do signals update to the period July 2021 to December 2022: This strategy have accumulated more than 110 likes and many traders have validated the predictive power of Financial Astrology.
DISCLAIMER: This indicator is experimental and don’t provide financial or investment advice, the main purpose is to demonstrate the predictive power of financial astrology. Any allocation of funds following the documented machine learning model prediction is a high-risk endeavour and it’s the users responsibility to practice healthy risk management according to your situation.
VWMA with kNN Machine Learning: MFI/ADXThis is an experimental strategy that uses a Volume-weighted MA (VWMA) crossing together with Machine Learning kNN filter that uses ADX and MFI to predict, whether the signal is useful. k-nearest neighbours (kNN) is one of the simplest Machine Learning classification algorithms: it puts input parameters in a multidimensional space, and then when a new set of parameters are given, it makes a prediction based on plurality vote of its k neighbours.
Money Flow Index (MFI) is an oscillator similar to RSI, but with volume taken into account. Average Directional Index (ADX) is an indicator of trend strength. By putting them together on two-dimensional space and checking, whether nearby values have indicated a strong uptrend or downtrend, we hope to filter out bad signals from the MA crossing strategy.
This is an experiment, so any feedback would be appreciated. It was tested on BTC/USDT pair on 5 minute timeframe. I am planning to expand this strategy in the future to include more moving averages and filters.
Morun Astro Trend MAs cross StrategyAstrology machine learning cycles indicator signals with technical MAs indicators strategy, based on signals index of Github project github.com
Machine Learning: kNN-based Strategy (update)kNN-based Strategy (FX and Crypto)
Description:
This update to the popular kNN-based strategy features:
improvements in the business logic,
an adjustible k value for the kNN model,
one more feature (MOM),
a streamlined signal filter and
some other minor fixes.
Now this script works in all timeframes !
I intentionally decided to publish this script separately
in order for the users to see the differences.
Machine Learning: LVQ-based StrategyLVQ-based Strategy (FX and Crypto)
Description:
Learning Vector Quantization (LVQ) can be understood as a special case of an artificial neural network, more precisely, it applies a winner-take-all learning-based approach. It is based on prototype supervised learning classification task and trains its weights through a competitive learning algorithm.
Algorithm:
Initialize weights
Train for 1 to N number of epochs
- Select a training example
- Compute the winning vector
- Update the winning vector
Classify test sample
The LVQ algorithm offers a framework to test various indicators easily to see if they have got any *predictive value*. One can easily add cog, wpr and others.
Note: TradingViews's playback feature helps to see this strategy in action. The algo is tested with BTCUSD/1Hour.
Warning: This is a preliminary version! Signals ARE repainting.
***Warning***: Signals LARGELY depend on hyperparams (lrate and epochs).
Style tags: Trend Following, Trend Analysis
Asset class: Equities, Futures, ETFs, Currencies and Commodities
Dataset: FX Minutes/Hours+++/Days
Machine Learning: Logistic RegressionMulti-timeframe Strategy based on Logistic Regression algorithm
Description:
This strategy uses a classic machine learning algorithm that came from statistics - Logistic Regression (LR).
The first and most important thing about logistic regression is that it is not a 'Regression' but a 'Classification' algorithm. The name itself is somewhat misleading. Regression gives a continuous numeric output but most of the time we need the output in classes (i.e. categorical, discrete). For example, we want to classify emails into “spam” or 'not spam', classify treatment into “success” or 'failure', classify statement into “right” or 'wrong', classify election data into 'fraudulent vote' or 'non-fraudulent vote', classify market move into 'long' or 'short' and so on. These are the examples of logistic regression having a binary output (also called dichotomous).
You can also think of logistic regression as a special case of linear regression when the outcome variable is categorical, where we are using log of odds as dependent variable. In simple words, it predicts the probability of occurrence of an event by fitting data to a logit function.
Basically, the theory behind Logistic Regression is very similar to the one from Linear Regression, where we seek to draw a best-fitting line over data points, but in Logistic Regression, we don’t directly fit a straight line to our data like in linear regression. Instead, we fit a S shaped curve, called Sigmoid, to our observations, that best SEPARATES data points. Technically speaking, the main goal of building the model is to find the parameters (weights) using gradient descent.
In this script the LR algorithm is retrained on each new bar trying to classify it into one of the two categories. This is done via the logistic_regression function by updating the weights w in the loop that continues for iterations number of times. In the end the weights are passed through the sigmoid function, yielding a prediction.
Mind that some assets require to modify the script's input parameters. For instance, when used with BTCUSD and USDJPY, the 'Normalization Lookback' parameter should be set down to 4 (2,...,5..), and optionally the 'Use Price Data for Signal Generation?' parameter should be checked. The defaults were tested with EURUSD.
Note: TradingViews's playback feature helps to see this strategy in action.
Warning: Signals ARE repainting.
Style tags: Trend Following, Trend Analysis
Asset class: Equities, Futures, ETFs, Currencies and Commodities
Dataset: FX Minutes/Hours/Days
Machine Learning: Perceptron-based strategyPerceptron-based strategy
Description:
The Learning Perceptron is the simplest possible artificial neural network (ANN), consisting of just a single neuron and capable of learning a certain class of binary classification problems. The idea behind ANNs is that by selecting good values for the weight parameters (and the bias), the ANN can model the relationships between the inputs and some target.
Generally, ANN neurons receive a number of inputs, weight each of those inputs, sum the weights, and then transform that sum using a special function called an activation function. The output of that activation function is then either used as the prediction (in a single neuron model) or is combined with the outputs of other neurons for further use in more complex models.
The purpose of the activation function is to take the input signal (that’s the weighted sum of the inputs and the bias) and turn it into an output signal. Think of this activation function as firing (activating) the neuron when it returns 1, and doing nothing when it returns 0. This sort of computation is accomplished with a function called step function: f(z) = {1 if z > 0 else 0}. This function then transforms any weighted sum of the inputs and converts it into a binary output (either 1 or 0). The trick to making this useful is finding (learning) a set of weights that lead to good predictions using this activation function.
Training our perceptron is simply a matter of initializing the weights to zero (or random value) and then implementing the perceptron learning rule, which just updates the weights based on the error of each observation with the current weights. This has the effect of moving the classifier’s decision boundary in the direction that would have helped it classify the last observation correctly. This is achieved via a for loop which iterates over each observation, making a prediction of each observation, calculating the error of that prediction and then updating the weights accordingly. In this way, weights are gradually updated until they converge. Each sweep through the training data is called an epoch.
In this script the perceptron is retrained on each new bar trying to classify this bar by drawing the moving average curve above or below the bar.
This script was tested with BTCUSD, USDJPY, and EURUSD.
Note: TradingViews's playback feature helps to see this strategy in action.
Warning: Signals ARE repainting.
Style tags: Trend Following, Trend Analysis
Asset class: Equities, Futures, ETFs, Currencies and Commodities
Dataset: FX Minutes/Hours+/Days
Machine Learning: kNN-based Strategy (mtf)This is a multi-timeframe version of the kNN-based strategy.
Machine Learning: kNN-based StrategykNN-based Strategy (FX and Crypto)
Description:
This strategy uses a classic machine learning algorithm - k Nearest Neighbours (kNN) - to let you find a prediction for the next (tomorrow's, next month's, etc.) market move. Being an unsupervised machine learning algorithm, kNN is one of the most simple learning algorithms.
To do a prediction of the next market move, the kNN algorithm uses the historic data, collected in 3 arrays - feature1, feature2 and directions, - and finds the k-nearest
neighbours of the current indicator(s) values.
The two dimensional kNN algorithm just has a look on what has happened in the past when the two indicators had a similar level. It then looks at the k nearest neighbours,
sees their state and thus classifies the current point.
The kNN algorithm offers a framework to test all kinds of indicators easily to see if they have got any *predictive value*. One can easily add cog, wpr and others.
Note: TradingViews's playback feature helps to see this strategy in action.
Warning: Signals ARE repainting.
Style tags: Trend Following, Trend Analysis
Asset class: Equities, Futures, ETFs, Currencies and Commodities
Dataset: FX Minutes/Hours+++/Days
Machine Learning / Longs [Experimental]Hello Traders/Programmers,
For long time I thought that if it's possible to make a script that has own memory and criterias in Pine. it would learn and find patterns as images according to given criterias. after we have arrays of strings, lines, labels I tried and made this experimental script. The script works only for Long positions.
Now lets look at how it works:
On each candle it creates an image of last 8 candles. before the image is created it finds highest/lowest levels of 8 candles, and creates a string with the lengths 64 (8 * 8). and for each square, it checks if it contains wick, green or red body, green or red body with wicks. see the following picture:
Each square gets the value:
0: nothing in it
1: only wick in it
2: only red body in it
3. only green body in it
4: red body and wick in it
5: green body and wick in it
And then it checks if price went up equal or higher than user-defined profit. if yes then it adds the image to the memory/array. and I call this part as Learning Part.
what I mean by image is:
if there is 1 or more element in the memory, it creates image for current 8 candles and checks the memory if there is a similar images. If the image has similarity higher than user-defined similarty level then if show the label "Matched" and similarity rate and the image in the memory. if it find any with the similarity rate is equal/greater than user-defined level then it stop searching more.
As an example matched image:
and then price increased and you got the profit :)
Options:
Period: if there is possible profit higher than user-defined minimum profit in that period, it checks the images from 2. to X. bars.
Min Profit: you need to set the minimum expected profit accordingly. for example in 1m chart don't enter %10 as min profit :)
Similarity Rate: as told above, you can set minimum similarity rate, higher similarity rate means better results but if you set higher rates, number of images will decrease. set it wisely :)
Max Memory Size: you can set number of images (that gives the profit equal/higher than you set) to be saved that in memory
Change Bar Color: optionally it can change bar colors if current image is found in the memory
Current version of the script doesn't check if the price reach the minimum profit target, so no statistics.
This is completely experimental work and I made it for fun. No one or no script can predict the future. and you should not try to predict the future.
P.S. it starts searching on last bar, it doesn't check historical bars. if you want you should check it in replay mode :)
if you get calculation time out error then hide/unhide the script. ;)
Enjoy!
Universal Scalping BOT (USB) - With AlertsThis Study Is based on
• RSI
• Moving Average
• Candlestick price action and
• Bulls Bears calculation.
This Study is Also has alerts inbuilt.
Alerts are for:
• Buy Active
• Buy Profit Achieved
• Buy Loss Hit
• Sell Active
• Sell Profit Achieved
• Sell Loss Hit
How to trade ?
• When Green big Up triangle Comes, Buy that time and book profit at red small circle and book loss at yellow down small triangle.
• When Red big Down triangle Comes, Sell that time and book profit at green small circle and book loss at yellow up small triangle.
► Options Available In Setting:
To Show / Hide :
• Target Line
• Stop-Loss Line
• Define Trading Sessions
► Trailing SL is calculated on candle stick price action and not on Average True Range.
Test Yourself and give feedback.
PM us to obtain access.
KBL PLAY-ZONE PLOTTER - MCX CRUDE OIL
► How To Use This Indicator ?
• New Intraday Trading Levels Will Be Generated At 09:30 AM (UTC +05:30)
• Buy If 5 Minutes Candle Close Above '' BreakOut Buy Here '' Level.
• Sell If 5 Minutes Candle Close Below '' BreakOut Sell Here '' Level.
• Book Profits At Breakout Buy or BreakOut Sell Targets.
• If 1st Call Target Hit , Then Do Not Trade More On That Day.
• If 1st Call StopLoss Hit , Then Only Trade On 2nd Call.
PM us to obtain access.
Neural Network CrawlAbout the Indicator
The Crawling Neural Network is a unique algorithm that identifies clusters of random walks that are crossing above or below the market price of the asset.
The random walks always exist, but the specific series that contribute to the cluster can only be seen during their significant period.
When the price trends strongly in a direction, it is more likely that it will traverse a significant amount of random walks and form a cluster.
The random walks are derived from a random selection of logarithmic movements in the last 200 bars and have been spawned at the beginning of price history.
Additionally, if you add the indicator to your chart multiple times and change the modifier in the settings panel, you can view more random walks that contribute to the clusters as seen in the screenshot below.
This indicator is available to everyone. Enjoy...
EPS AIThis indicator can be accessed by ANYONE by searching in the public indicator library located at the top of your chart!
Enjoy!
Introduction
This indicator uses machine learning to predict the next Earnings Per Share (EPS) figure.
The algorithm learns from previous figures in order to more accurately predict the next.
As time continues, this indicator will become more accurate as it learns from an increased amount of data from earnings results.
When the Future Projected EPS is positive, the line will appear green . When the Future Projected EPS is negative, the line will appear as red and sit below the EPS.
Settings Panel
The settings panel contains two tick-boxes.
Quarterly Earnings : When selected, the EPS and future projected EPS will utilise quarterly results. Yearly results are used by default.
Diluted EPS : When selected, the Diluted EPS and future projected Diluted EPS will be utilised. Basic EPS is used by default.
Indicator Utility
The EPS AI can be utilised on every securities instrument and time-frame.
This indicator has been built in Pinescript V4 and will operate in real-time.
This indicator can be accessed by ANYONE by searching in the public indicator library located at the top of your chart!
Enjoy!
ANN BTC MTF Golden Cross Period MACDHi, this is the MACD version of the ANN BTC Multi Timeframe Script.
The MACD Periods were approximated to the Golden Cross values.
MACD Lengths :
Signal Length = 25
Fast Length = 50
Slow Length = 200
Regards.
NAND PerceptronExperimental NAND Perceptron based upon Python template that aims to predict NAND Gate Outputs. A Perceptron is one of the foundational building blocks of nearly all advanced Neural Network layers and models for Algo trading and Machine Learning.
The goal behind this script was threefold:
To prove and demonstrate that an ACTUAL working neural net can be implemented in Pine, even if incomplete.
To pave the way for other traders and coders to iterate on this script and push the boundaries of Tradingview strategies and indicators.
To see if a self-contained neural network component for parameter optimization within Pinescript was hypothetically possible.
NOTE: This is a highly experimental proof of concept - this is NOT a ready-made template to include or integrate into existing strategies and indicators, yet (emphasis YET - neural networks have a lot of potential utility and potential when utilized and implemented properly).
Hardcoded NAND Gate outputs with Bias column (X0):
// NAND Gate + X0 Bias and Y-true
// X0 // X1 // X2 // Y
// 1 // 0 // 0 // 1
// 1 // 0 // 1 // 1
// 1 // 1 // 0 // 1
// 1 // 1 // 1 // 0
Column X0 is bias feature/input
Column X1 and X2 are the NAND Gate
Column Y is the y-true values for the NAND gate
yhat is the prediction at that timestep
F0,F1,F2,F3 are the Dot products of the Weights (W0,W1,W2) and the input features (X0,X1,X2)
Learning rate and activation function threshold are enabled by default as input parameters
Uncomment sections for more training iterations/epochs:
Loop optimizations would be amazing to have for a selectable length for training iterations/epochs but I'm not sure if it's possible in Pine with how this script is structured.
Error metrics and loss have not been implemented due to difficulty with script length and iterations vs epochs - I haven't been able to configure the input parameters to successfully predict the right values for all four y-true values for the NAND gate (only been able to get 3/4; If you're able to get all four predictions to be correct, let me know, please).
// //---- REFERENCE for final output
// A3 := 1, y0 true
// B3 := 1, y1 true
// C3 := 1, y2 true
// D3 := 0, y3 true
PLEASE READ: Source article/template and main code reference:
towardsdatascience.com
towardsdatascience.com
towardsdatascience.com
CBOE PCR Factor Dependent Variable Odd Generator This script is the my Dependent Variable Odd Generator script :
with the Put / Call Ratio ( PCR ) appended, only for CBOE and the instruments connected to it.
For CBOE this script is more accurate and faster than Dependent Variable Odd Generator. And the stagnant market odds are better and more realistic.
Do not use for timeframe periods less than 1 day.
Because PCR data may give repaint error.
My advice is to use the 1-week bars to gain insight into your analysis.
This code is open source under the MIT license. If you have any improvements or corrections to suggest, please send me a pull request via the github repository github.com
I hope it will help your work.Best regards!