Forecasting
How forecasting can benefit your trading journey
Hi everyone:
In this quick educational video, I will go over how I incorporate “forecasting” in my trading, and how that helps me to be a better trader overall emotionally and psychologically.
Couple things you “forecast” prior to the actual entry:
1. You should draw out the different possibilities on the price’s movement.
Different possible scenarios if possible. IF you are looking for short, then draw out the actual move from where the current price is, and take a screenshot of the possible move.
This allows you to remember your plan to execute the position once it appears.
2. You should also think about a back up plan, what if the price goes up now instead of down from your analysis ?
Are you still looking for short then? Or are you going to change your bias if price action then develops bullish price action instead?
You should prepare yourself if your bias is wrong, then what would you do next.
3. Utilize the R:R tool box, “forecast” the actual entry, SL, potential TP.
This will allow you to understand your R: R and where you would set your first, second targets.
Take screenshots if necessary to remember.
4. Forecast what you will do once price hits your TP.
Are you simply just going to exit the trades now, or will the further development of price action give you extra confidence that the trade can keep going, and you should hold on to the trade?
What do you want to see from the price action in order to change your thoughts?
This will eliminate emotions as to whether to hold onto a trade or take profit.
As you do more and more of these forecasts, the actual entry will be relatively easy.
You have already forecast the possible scenarios, entry, SL, TP, continuation..etc. So there won't be any fear of losing, or fear of missing out.
That will help you to keep your emotions at bay, and execute the trades accordingly.
Many beginner traders often lose money because they are not prepared for what the market will do. When something happens, then they react to the situation. Often enough it's too late, and they will make a decision based on emotion.
Forecasting allows you to eliminate those emotions, and let your plan run.
As always, let me know if you have any questions or comments.
Thank you
Development Log for Neural Network PrototypeThe idea, at the core:
Port a limited RNN/LSTM Neural Network model from Python with a reduced training set and dimension size for layers to demonstrate that a fully functional (even if limited) Neural Net can work in Pine.
Limited model + having the python code on hand = Able to test and verify components in Pine at every step, in theory
The model/script I'm attempting to implement a limited subset of is detailed here:
iamtrask.github.io
A dataset in binary is required, but binary does not exist in pinescript, thus:
To do this, decimal to binary and binary to decimal functions are required. This didn't exist previously - I've written a script to accomplish just that:
Originally, this was going to have a input_dim of 2, hidden_dim of 16, but I've changed the hidden_dim to 8 (binary dimensions from 8 to 5) to reduce the dataset range to max 32 while I figure out to implement working pseudo-arrays and state updates. I've looked at RicardoSantos's scripts for Markov and Pseudoarrays, and will be using them as a reference going forward.
I've verified the output of the Sigmoid function and 1st derivative of the Sigmoid function in Python for values of (-1,0,0.5,1 ). I've yet to publish the Sigmoid script pending approval from TV moderators about including python code that is commented out at the bottom to verify the results of that script.
What I'm trying to do here with training dataset generation was unsuccessful, for multiple reasons:
Lack of formal array constructs in pine
Psuedorandom Number generator limitations
Manual state weighting and updating as per RicardoSantos's Function Markov Process is required:
What's being plotted for are the first three layers, but without the full range of the input_dimensions, hidden_dimensions:
syn_0 (blue)
syn_1 (green)
syn_h (red)
While there's more than a few technical hurdles to overcome (i.e. potential pine issues from max variables to runtime/compile limits, no real arrays, functions to do state updates RichardoSantos Markov Function style, etc), I'm fairly confident a limited working model should be possible to create in Pine.
Indicators Input Window Length - Problems And SolutionsIntroduction
Most technical indicators possesses a user defined input window length, this input affect the indicator output and for a long time, have been the cause of many innovations in technical analysis.
In this post i want to discuss the effects and particularities of indicators inputs window length, the challenges they introduce in trading and their effect when paired with machine learning forecasting models, i hope this post will be easy to read, let me know if you had difficulties understanding it.
Speed And Efficiency Problems
An input window length can involve the number of data processed by the indicator, therefore higher window length's will process more data, which result in a slower computation time, therefore in high-frequency/algorithmic trading where response time matter, maximizing the profitability might be made at the cost of the indicator response time, and even if computerized trading has been praised for its speed, small lag times can actually affect your strategy, therefore one might enter a trade at a different value than the targeted price.
Note : High frequency trading (hft) is a commonly mistaken term, one might believe that hft require the trader to open and close a large number of trades in a short amount of time, in reality hft is related to the "rate at which data is processed".
Solution - Efficient Data Processing
Solutions have been proposed in order to make certain tools more efficient. For example the simple moving average is a common tool that is the basis of many other indicators, its calculation involve summing the length last data points and diving this sum by length . In signal processing, such tool require what is called "memory", the data points must be stored in order for them to be processed, this is extremely inefficient and slow, therefore alternatives have been proposed, one of them is still mainly used in technical analysis today and is called the exponential moving average (ema), the process of computing an exponential moving average is called exponential averaging, and has the form of :
ema = sc*input+(1-sc)*(past ema value)
where sc is called the smoothing constant where 1 > sc > 0 . We only need 2 data values in order to perform this computation, lets denote a moving average of period length sma(input,length) , we can estimate it using exponential averaging with sc = 2/(length+1) . The computation time of the exponential moving average is way lower than the one of the sma . This is the most elegant and efficient estimation of the simple moving average.
The exponential moving average is the simplest "IIR Filter", or infinite response filter, those filters are as well extremely efficient since they use recursion. Exponential averaging is also the core of many adaptive indicators. In my experience, recursion will always let you create extremely efficient tools.
Window Length And Optimization Problems
Optimization is a branch of mathematics that help us find the best parameters in order to maximize/minimize a certain function, and thanks to computers this process can be made faster. Optimizing technical indicators during backtesting involve finding the input window length (set of inputs if there are more than 1 input) that maximize the profit of a strategy.
The most common approach is brute forcing, in which we test every indicator inputs window length combination and keep the one that yield the best results. However optimization is still computationally intensive, having 2 indicators already involve a high number of combinations. This is why it is important to select a low number of indicators for your strategy. But then other problems arise, the best input window length (set of inputs) might change in the future. This is due to the fact the market price is non-stationary and one of the reasons technical indicators are looked down.
In order to deal with this problem, we can propose the following solutions :
Use indicators/Information with no input window length -> Vwap/Volume/True Range/Cumulative Mean...etc.
Study the relationship between the optimal input window length and price evolution -> Regression analysis
Forecast the optimal input window length -> Forecasting
The last two are extremely inefficient, kinda nightmarish, and would be time consuming if one use a serious backtesting procedure. However the first solution is still appealing and might actually provide a efficient result.
Machine Learning Forecasting - Performance And Technical indicators Input Window Length Dependency
Technical indicators outputs can be used as inputs for machine learning algorithms. We could think that we also need to optimize the input window length of the indicators when using machine learning (which would lead to high computations time, machine learning already involve optimization of a high number of parameters), however a research paper named "Forecasting price movements using technical indicators: Investigating the impact of varying input window length" by Yauheniya Shynkevicha, T.M. McGinnitya, Sonya A. Colemana, Ammar Belatrechec and Yuhua Li highlight an interesting phenomenon, the abstract tell us that :
"The highest prediction performance is observed when the input window length is approximately equal to the forecast horizon"
In short, if you want to forecast market price 14 step ahead with a machine learning model, you should use indicators with input window length approximately equal to 14 as inputs for the model in order to get the best performance. This would allow to skip a lot of optimizations processes regarding the technical indicators used in the model. They used 3 different type of ML algorithms, support vector machine (svm) , adversarial neural networks (ann) and k nearest neighboring (knn) , which reinforce their conclusion.
In the paper, we can see something interesting with the indicators they selected as inputs, they used : A simple moving average, an exponential moving average, the average true range, the Average Directional Movement Index, CCI, ROC, RSI, %R, stochastic oscillator.
First thing we can see is that they used the exponential moving average instead of the wilder moving average for certain calculations, which i think is a good choice. We can also see they used many indicators outputting the same kind of information, in this case we often talk about "Multicollinearity", for example :
The CCI, ROC, RSI, %R, Stochastic output similar information, all remove the trend in the price, the CCI and ROC are both centered around 0 and the %R, RSI and stochastic oscillator around 50. The SMA and EMA also output similar information.
In technical analysis this practice is often discouraged since the indicators will output the same kind of information, this lead to redundancy. However such practice has been seen a lot in machine learning models using technical indicators. Maybe that a higher amount of multicollinearity between indicators allow to strengthen the relationship between the forecast horizon and the indicators input window length.
Conclusion
We talked (a lot) about indicator inputs window length, what problems they cause us and how we can find solutions to those problems. Also we have seen that the forecasting performance of ML models can be higher when they use indicators outputs with input window length equal to the forecasting horizon. This can make to make the process of forecasting financial market price with ML models using technical indicators more efficient.
ML is a recurring subject in financial forecasting, those algorithms offer the hope to make technical indicators more useful, and indeed, technical indicators and ML models can benefits from each others, however it is sad to observe that classical indicators are mainly used instead of newer ones, but its also encouraging in the sense that more research can be done, using newer material/procedures.
Thanks for reading !
Our Rationale of Forecasting Methods at NinjaSingaporeHaving been in this industry for more than 14 years, we have tried many approaches - trading indicators, price action, eye-balling techniques and ... many others you can think of. At the end of the day, we have found what works for us.
1. A clean chart that clearly shows a trend. An uptrend is defined as a series of higher highs and high lows. A downtrend is defined as a series of lower highs and lower lows. It's as simple as that.
2. If an uptrend exists, we wait for the price to come down to a certain level to initiate our buy stop order. If a downtrend exists, we wait for the price to go up to a certain level to initiate our sell stop order.
3. No matter whether it is a buy-stop or a sell-stop, we always set a stop loss and using the price range to determine the contract size of our position.
4. Let the trade do what it is supposed to do. There is no need to pray, wish, dream or hope. It's over. The market will either agree with you by giving you the profits or disagree with you by taking your money away as a loss.
5. Your job as a trader is to ensure you gain more than you loss so that overall your account will be green or black.
6. If you have a series of losing trades, which will happen for sure in your career (guaranteed1), you need to have a set of rules to help you clear your little voices in your head. In such cases, you may consider hiring a life coaching who specialises in clearing process to help you. Alternatively, if you know how to do 7-PATH Self Hypnosis, do it as it will help certainly.
7. As a rule of thumb, successful trading is 80% trading psychology (minimum) and 20% trading techniques or skills.
8. There is a ton of information in the internet for you to visit. Read and watch as much as you can and keep on doing it. This is a career or a business. You need to constantly feed yourself with useful and relevant information to trading.
9. I am not against hiring a mentor or a coach to help you expedite your trading success. Just beware of the black-sheep in the market as this industry does have a lot of scammers who are making their money by teaching others rather from trading.
Good trading
NinjaSingapore
24 December 2017
A thread about STRUCTURE!This entire thread will be for STRUCTURE!
In the "idea updates" column I will be posting all types of
corrective and impulsive structures!
When it comes to trading the waves, the 12345ABC we all
love to draw when we first learned about the theory will be
useless (most of the time)
What we should focus on is if we're in correction, and if so
how the heck can we trade the next impulse!
Every instrument I look at i will post here.
As long as there is structure it will be fine to be posted here!