Average on equity
Forums › ProRealTime English forum › ProBuilder support › Average on equity
- This topic has 10 replies, 4 voices, and was last updated 8 years ago by Nicolas.
-
-
06/19/2016 at 4:30 PM #9562
Hi.
There’s a way to have average on equity line inside a trading system code?
Thanks.
Andrea
06/19/2016 at 6:56 PM #956306/19/2016 at 7:00 PM #9564Thanks.
How can i compute my equity variabile?
06/19/2016 at 7:32 PM #956706/19/2016 at 8:50 PM #956910/14/2016 at 6:17 PM #14917Hi
Thank you for the code. What I have to do if I want that the strategy only trade if the equity curve is above the moving average (of the Equity curve)? I tried it with this one but it doesn`t work:
123456myequity = (((close-positionprice)*pointvalue)*countofposition)/pipsize + strategyprofitavg = average[20](myequity)IF NOT OnMarket AND l10 AND l20 AND (strategyprofit > avg) THENBUY 1 CONTRACTS AT MARKET NEXTBAROPENENDIF10/15/2016 at 9:52 AM #14932I’m sorry, I forgot something important. It’s more complicated than I thought. I have inserted a picture to illustrate it.
If the equity curve is above the MA, then the system trades (it`s online). If the equity curve is below the MA then the system must be offline. The problem is, however, that the strategy have to make “fictitious order” (without really buying contracts) so you can get back in the system as soon as the strategy is again over the MA. Hope you understand what I mean.
11/15/2016 at 6:13 AM #16544Hi, did you work a way around this problem?
11/15/2016 at 9:34 AM #1655111/15/2016 at 10:41 AM #16558I did not test the code Skubidu made, but from my own experience, trading the equity curve is a dead-end. I used to make a lot of tries and experimentation on this on other trading software languages, with fictitious orders but the result is almost always the same :
- you miss a lot of good trades, your strategy is “broken”..
- even if a fictitious trade made good gain for the equity curve to be above the average, the next trade could a looser and same thing happen again: you need to make new fictitious trade, etc.
It results at the end that your strategy is not a looser one, but not a winner one. The equity curve of the overall strategy backtest is almost like a flat line.
However, this is something very interesting for educational purpose, I may write something about it in the blog.
11/21/2016 at 9:30 AM #16881For your information, Wisko have solved the problem of not displaying correctly the equity curve for the IG accounts users, you can have a look it here:
http://www.prorealcode.com/blog/trading-strategy-profit-curve/#comment-2189
Here is the full code he get from PRT to fix this issue:
123456789101112if not onmarket thenmystrategyprofit=strategyprofitelsif longonmarket thenmystrategyprofit=strategyprofit+(close-tradeprice)/pointsize*pointvalue*countoflongshareselsif shortonmarket thenmystrategyprofit=strategyprofit+(tradeprice-close)/pointsize*pointvalue*countofshortsharesendifequitycurve = exponentialaverage[a](mystrategyprofit)GRAPH mystrategyprofit as "strategy profit"GRAPH equitycurve coloured(255,0,0) as "profit curve"Hope it helps here too 🙂
-
AuthorPosts
Find exclusive trading pro-tools on