Neural networks programming with prorealtime
Forums › ProRealTime English forum › ProBuilder support › Neural networks programming with prorealtime
- This topic has 126 replies, 8 voices, and was last updated 1 year ago by MobiusGrey.
Tagged: data mining, machine learning
-
-
08/18/2018 at 12:07 AM #78510
Hi all,
I start to be interesting in Neural Network, it seems to be possible to do in prorealtime even though it has not Arrays (brace yourself, very long codes are coming).
Now with multi-time-frame support and neural network, looks very interesting for trading.
I found a very useful web that explain neural network in very simple way:
http://neuralnetworksanddeeplearning.com/chap1.html
I will start experimenting with this topic.
For example, I code a Classifier for long entries.
1234567891011121314151617181920212223242526272829303132//Variables://candlesback=5//ProfitRiskRatio=2//spread=1.5myATR=average[20](range)//+std[20](range)ExtraStopLoss=MyATR//ExtraStopLoss=3*spread*pipsizeclassifier=0//for long tradesFOR scan=1 to candlesback DOIF classifier[scan]=1 thenBREAKENDIFLongTradeLength=ProfitRiskRatio*(close[scan]-(low[scan]-ExtraStopLoss[scan]))IF close[scan]+LongTradeLength < high-spread*pipsize thenIF lowest[scan+1](low) > low[scan]-ExtraStopLoss[scan]+spread*pipsize thenclassifier=1candleentry=barindex-scanBREAKENDIFENDIFNEXTIF classifier=1 thenDRAWSEGMENT(candleentry,close[barindex-candleentry],barindex,close[barindex-candleentry]+LongTradeLength) COLOURED(0,250,0)DRAWELLIPSE(candleentry-1,low[barindex-candleentry]-ExtraStopLoss,barindex+1,high+ExtraStopLoss) COLOURED(0,250,0)ENDIFreturn5 users thanked author for this post.
08/18/2018 at 11:00 AM #78523I will start experimenting with this topic.
I added TP, SL and a Filter on 5m TF on DJI and I’ve set it going on Demo Fwd Test.
Thank You for sharing @Leo … I look forward to your own Topic on Neurals!
1 user thanked author for this post.
08/18/2018 at 2:35 PM #7853408/18/2018 at 5:53 PM #7855408/18/2018 at 8:10 PM #7856808/18/2018 at 8:34 PM #7856908/21/2018 at 4:16 PM #78706Nope, I moved the discussion to a separate topic, thank you Leo for sharing the code. I subscribe and will follow it with great interest.
Thanks for the interesting shown. I will do my best.
08/21/2018 at 4:20 PM #78707Your indicator is very interesting, thanks for sharing
Is it possible to make a red ellipse contrary to the one that has been published? … That is to say for sell
You should know that what I posted is not an indicator is a Classifier for the Neural Network, it just shows where and when would has been a winning trade. I post later the full Classifier
08/21/2018 at 4:23 PM #7870808/21/2018 at 4:34 PM #78709I will start experimenting with this topic.
I added TP, SL and a Filter on 5m TF on DJI and I’ve set it going on Demo Fwd Test.
Thank You for sharing @leo … I look forward to your own Topic on Neurals!
Hey Grahal, which function do you use for the output neurons?
08/21/2018 at 4:48 PM #78713it just shows where and when would has been a winning trade.
This was what I thought by looking at the code, I did not had time to test, shame on me 🙁 So I’m wondering how did GraHal use the code to trigger trades in this case?
Any ideas for this 4 inputs?
You could try to make your simple layer as an independent indicator and use it as a function by CALLing it into a synthetic indicator. It should work if you are not falling into the infinite loop limitation of ProBuilder …
08/22/2018 at 10:47 AM #78764Thank you Leo, no offence, but the “problem” with the indicator is that it obviously knows what happened (because it “data mines”) and it loose the information each time it has found a new setup, it doesn’t save it.
How to you plan to take advantages of what the function learned? This is what I think about:
- function is looking back
- function is finding a good setup according to your criteria ( example: ProfitRiskRatio=2 )
- function is starting a new loop in the past starting from the first candle of the good setup found at point 2/
- function is looking for a “similarity”
- similarity is found, increase the score
The “similarity” could be anything from a basic candlestick pattern to an oscillator in oversold territory, for example..
If score > x% then you may have found a valid setup that could be considerate as robust.
I’ll try to code something quickly..
1 user thanked author for this post.
08/22/2018 at 1:25 PM #78789This is a sample code (template) for what I was talking in my previous post:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748//--- settingscandlesback=5ProfitRiskRatio=2spread=1.5//--- end of settingsmyATR=average[20](range)ExtraStopLoss=MyATR// *** DEFINE SIMILARITY ***similarity = rsi[14] crosses over 50// *** GOOD SETUP FINDER ***classifier=0//for long tradesFOR scan=1 to candlesback DOIF classifier[scan]=1 thenBREAKENDIFLongTradeLength=ProfitRiskRatio*(close[scan]-(low[scan]-ExtraStopLoss[scan]))IF close[scan]+LongTradeLength < high-spread*pipsize thenIF lowest[scan+1](low) > low[scan]-ExtraStopLoss[scan]+spread*pipsize thenclassifier=1candleentry=barindex-scanBREAKENDIFENDIFNEXT// *** GOOD SETUP FOUND ***IF classifier=1 then// increase the setup countsetup = setup+1// plot good setupDRAWSEGMENT(candleentry,close[barindex-candleentry],barindex,close[barindex-candleentry]+LongTradeLength) COLOURED(0,250,0)DRAWELLIPSE(candleentry-1,low[barindex-candleentry]-ExtraStopLoss,barindex+1,high+ExtraStopLoss) COLOURED(0,250,0)//check for similaritysimilar = summation[candlesback](similarity[1])[barindex-candleentry]>0if similar then// plot where a similarity is founddrawarrowup(candleentry,low[barindex-candleentry]) coloured(0,0,255)// increase the similarity countsimcount = simcount+1// *** PERCENTAGE OF SIMILARITY AGAINST SETUP ***percent = round(simcount/setup*100)drawtext("#percent#%",candleentry,low[barindex-candleentry]-averagetruerange[14],dialog,bold,14)endifendifIn this example, the “similarity” is a simple RSI[14] crossing over the level 50. If it has occurred at least 1 time (during ‘candlesback’) before the beginning of a setup, it scores 1 point. As for the attached picture, the similarity has been found 30% for all the setup (marked with a blue arrow).
1 user thanked author for this post.
08/23/2018 at 9:41 PM #78880Hi Nicolas,
Your code is a very good idea and concept for machine learning using correlations:
The classifier (as I said before is not an indicator) detects a perfect trade and we start to store information and data in that moment ( what you call similarity1, similarity2, similarity3, etc), and study if there is a correlation between the “perfect trade” and the “similarity”
As far as I understand Neuronal Networks, we choose a number of inputs for example rsi[14], adx [20], (close-average[20]), etc, etc, and the variables in the neurons “store” several and many correlations, behaviours, sentiments or whatever you want to call it ( in facts some autors claim that neutonal networks can learn anything if we provide enough data)…. and if that behaviour change… the neural network change and adapt as well!!!
Thats the beauty of Neuronal Networks.
One can imagine that without Array support in ProRealTime is almost impossible…. well, we together can find it out…
I always keep in mind that the financial markets do whatever they want… it doesn’t matter how complex the neuronal network is.
08/23/2018 at 9:45 PM #78881Here is the video that open my mind to the potential of Neural Network in prorealtime
https://www.youtube.com/watch?v=ILsA4nyG7I0
3 users thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on