Support Board
Date/Time: Mon, 24 Feb 2025 22:31:24 +0000
[Programming Help] - Moving average based on Closed Profit/Loss study
View Count: 775
[2021-03-25 11:24:17] |
jeden8l - Posts: 48 |
Hello SC. I'm having a problem with SMA based on Closed Profit/Loss subgraph. As far I looked this up it seems the SMA pulls data from each consecutive bar, not from every P/L change. This makes it almost precisely same SMA line as P/L line. Here is the same backtest put on different timeframes: http://www.sierrachart.com/image.php?Image=1616670620231.png http://www.sierrachart.com/image.php?Image=1616670738528.png Do I have to find coder able to pull Closed P/L data directly and make SMA out if this instead of pulling it from each bar? I need a simple filter, this excel chart is a tick P/L with SMAx: https://imgur.com/a/vYcbuzW Exactly what I need in Sierra platform real time to be able to add a condition to CBBOAC. |
[2021-03-25 21:20:43] |
jeden8l - Posts: 48 |
Ok, as this obviously been tagged as [Programming Help] straight away I'm looking for programmer who is able to look into this for me.
|
[2021-03-25 21:56:42] |
Sawtooth - Posts: 4174 |
You could use the Spreadsheet Formula study to find every P/L change, with a formula like this in the Formula field: =IF(ID4.SG1<>ID4.SG1[-1],ID4.SG1,0) where the Trading: Closed Profit/Loss study is ID4. Then use the Moving Average-Simple Skip Zeros study, with the Based On set to the Spreadsheet Formula study. Set the Chart Region of the SMA-SkipZeros study to the same as the P/L study. Date Time Of Last Edit: 2021-03-25 23:13:33
|
[2021-03-26 15:02:14] |
jeden8l - Posts: 48 |
@tomgilb thank you for your help, unfortunately this does not seem to work either. Here's an outcome of what you advised: Backtest made on volume bars, then I overlayed it to 5min and 4h chart which look like this: http://www.sierrachart.com/image.php?Image=1616770691480.png http://www.sierrachart.com/image.php?Image=161677043053.png Green line supposed to be a SMA300, but in my opinion is nowhere close to it. Can someone explain what's going on? Date Time Of Last Edit: 2021-03-26 15:09:37
|
[2021-03-26 22:24:42] |
Sawtooth - Posts: 4174 |
Suggestions/comments: 1. - When using the Study/Price Overlay study to/from a non-time-based chart, the 'Data Copy Mode' needs to be set to 'Earliest...' Auto Trade System Back Testing: Performing Back Testing on a Trading System That Uses Multiple Charts - You can also try the different settings of 'Bar Time Matching Method'. - 'Fill Blanks With Last Value' will need to be 'Yes'. 2. Try overlaying the the Closed P/L study to the 5min and 4h charts, then use the Spreadsheet Formula/SMA skip zeros on the overlaid P/L study. You'll have to adjust the SMA's length to something equivalent. 3. A 100 volume chart of the GC will have mostly shorter timed bars than 5 minutes, so when you overlay to a 5min or 4h, you will have blank times that will be filled with the Last value. This will give the appearance of flat segments. |
To post a message in this thread, you need to log in with your Sierra Chart account: