shugParticipant
Senior
even managed to draw a satalight dish on my screen lol.
shugParticipant
Senior
// ================================================================
// GBM Projection Cone — Ito's Lemma closed-form solution
// S(t) = S0 * EXP( (mu - 0.5*sigma^2)*t + sigma*W(t) )
// Plotted here as E[S(t)] with a +/- K*sigma*sqrt(t) lognormal band
// ================================================================
DEFPARAM DrawOnLastBarOnly = true
// ---------- inputs ----------
Length = 100 // bars of history used to estimate mu and sigma
Horizon = 30 // bars projected into the future
K = 2 // confidence band width, in std devs of ln(S)
// ---------- estimate mu and sigma from log returns ----------
SumR = 0
SumR2 = 0
FOR i = 0 TO Length-1 DO
r = LOG(Close[i]/Close[i+1])
SumR = SumR + r
SumR2 = SumR2 + r*r
NEXT
Mu = SumR/Length
Var = SumR2/Length - Mu*Mu
Sigma = SQRT(MAX(Var,0))
// ---------- draw the projection cone from the current bar ----------
S0 = Close
PrevMed = S0
PrevUp = S0
PrevDn = S0
FOR t = 1 TO Horizon DO
Med = S0 * EXP((Mu - 0.5*Sigma*Sigma)*t)
Up = Med * EXP(K*Sigma*SQRT(t))
Dn = Med * EXP(-K*Sigma*SQRT(t))
DRAWSEGMENT(BarIndex+t-1, PrevMed, BarIndex+t, Med) COLOURED(0,90,200)
DRAWSEGMENT(BarIndex+t-1, PrevUp, BarIndex+t, Up) COLOURED(160,160,160)
DRAWSEGMENT(BarIndex+t-1, PrevDn, BarIndex+t, Dn) COLOURED(160,160,160)
PrevMed = Med
PrevUp = Up
PrevDn = Dn
NEXT
RETURN
shugParticipant
Senior
I’m not endorsing any of the above if someone wants to play with it good luck!
shugParticipant
Senior
Just a wee note to anyone intrested, I have been playing with A.I like many others to sift information, sort information, run backtests etc then write script for prorealtime with the outcomes. I have tested 1 min bars over 5 years on most of the markets I currently trade. I have used 3 diffrent A.I’s to do these tests using python etc.
The first thing I noticed was that I had to be very specific on my statements, commands and questions which is understandable, Also I had to externally find data that was reliable, download it to my computer then run things from there using scripts build by the A.I. based on my demands.
First off the bat; the A.I makes a lot of mistakes by assumming you meant this or that, the amount of mistakes it makes is unbelievavble you end up sitting for many hours correcting the thing and even then the codes keep having to be modified, it genually feels like the thing is against you delibratly! even then, can the codes or information be reliable to trust?
who knows but my experience is that the A.I is amazing at doing calculations crunching numbers as is python, there is no way on earth a human being could compete with that but there is no way i’d trust placing big trade amounts on it until i spent the time forward testing it.
Some of the prorealtime codes it generated for me to place actual real money deals failed to take deals on or off at the specified times, probably because it had to trade diffrent timers of day and some of the trades ran into each other but the ai tripple checked that code and couldnt find anything wrong with it.
I’m not sure which is best, to write 1 prorealtime script for gold for example that goes on and off a few times a day diffrent directions ect or open 9 charts of gold and place each script for 1 trade on each of them? you guys have more experience with this than me and i’d like input?
shugParticipant
Senior
Just aother point I know you will pick up on, i run backtests on 5 years of 1 minute bars on all of my markets i trade and the results of those show good results but 5 years ago that market ran completely diffrent from what tyhey do now so how many years do you test? 1 year? 2 years or 3 years? i ran through year, month week etc then compared the diffrencies then i done month on month over the 5 years to get the diffrence, the message is this if your going to test properly it will take time and there will be a lot of work to clean things up and make it usable and thats if your not too busy finding things the ai or the ai tests didnt pick up. The only reason I started playing with this was to automate my trades as there is a lot of trades to place, some during the day on diffrent markets and ones over night as well, im not a robot i need sleep so i thought id get a robot to do it for me.
Something else that popped into my mind there, most results that you get will tell you that placing the trades at certain times looks great on the backtest until you see that at those times the spread jumps, there is no way you could get the cheaper spread and thats how the test looks good! just something to be aware of factoring that in before the test starts!
JSParticipant
Master
What strikes me on the forum is that more and more users seem to rely on AI without first developing a basic understanding of the platform they are using…
In my opinion, this is one of the biggest pitfalls of using AI for algorithmic trading…
If you don’t understand how ProRealTime works, you won’t know which questions to ask, you won’t recognise incorrect assumptions, and you won’t be able to verify whether the generated code is actually correct…
AI can be extremely useful for analysing complex problems, exploring ideas and deepening your understanding of subjects you are already familiar with…
But using it as a kind of magic tool to generate trading strategies that are expected to make money is a completely different matter…
There is also an important distinction between code that is syntactically correct, code that functions correctly within ProRealTime, and a strategy that is actually profitable…
These are three very different things, each requiring its own validation… (syntactic, functional, strategic)
shugParticipant
Senior
You are correct on those points, this is a learning curve I personally haven’t had to deal with as I dont use indicators and my systems are based on history, time and price alone so A.I should be able to work with those without issues using A.I. I have been trading over ten years without prorealtime codes or A.I but recently found it could be useful I suppose its down to the indevidual and there own circumstances. I’m focused on concentrating on my own observatrions on the charts then testing them, its a bit diffrent from building a trading system using A.I.
shug wrote: how many years do you test? 1 year? 2 years or 3 years?
I rarely backtest when optimising over more than 12 months, often only over the most recent ‘few months’.
Above is partly due to the slowness of the optimiser, but also because – as you point out – markets change over the years, months and even weeks.
Surely there can only be a finite number of ‘ways the market changes’ and so if one optimise-backtests over 5 or 10 years then maybe, just maybe, the resulting strategy might be able to ‘weather the storm’ of market changes??
When I have done the above as a trial and then reduced the period to the most recent 10K bars, the most recent performance shows up as not impressive at all and often abysmal. For this reason, I long ago abandoned doing time-consuming optimising backtests of the order of 100k bars to 200k bars etc.
shugParticipant
Senior
I’m still not sure which is best, to write 1 prorealtime script for gold for example that goes on and off a few times a day diffrent directions ect or open 9 charts of gold and place each script for 1 trade on each of them? whats your thoughts on this?
shugParticipant
Senior
The reason I thought a longer backtest would be good was to get the best time to trade, the best direction to trade, the best months to trade the best minute to trade and the best days to trade historically then eliminate the poor results and leave the good results then optimize again before testing over again to getter the numbers looking better
shugParticipant
Senior
if nothing else, the idea sounds plausable LOL
shugParticipant
Senior
The test i carry out after that include stop losses as well as trailing stops etc
Alot of varables and tests should provide an insight into my own observations and save time forward testing to find out the same information as time is the most valuble of my posessions
shugParticipant
Senior
Suns shinning and my dogs looking at me, hes thinking same as me; lets get out a long walk and enjoy not trading over the weekend! have a great day!!!!
Shug, you sure have ‘come on a lot’ re coding … just before the introduction of PRCAI you were going to give it up? Did you ever get your wife going on the coding etc?
shug wrote: I’m still not sure which is best
Try both methods, but back each method with 50% of the position size you were going to use on only one method. Review results after 1 month?
Or, assuming you are testing on a demo account running on live data, (this is recommended), just try both methods and review after 1 month.