Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 12:37:28 +0000



Daily Change %

View Count: 531

[2019-01-15 23:21:13]
PeterSt - Posts: 36
Dear SC Support - I am really sorry to bother you again, but today the whole day I have been tracking down strangenesses regarding P&L and for this thread I will stick to the "PercentSinceOpen" which could be the base issue of it all, although I do not use this in any math except for proof of concept. Something is wrong in my working, clearly.

Please have a look at attached Sierra23. Let's say that the DChg in the top line is OK because it is Sierra's. Also I compared with other figures and what I show in the number at the mouse pointer has to be off. But now why ...

    SCDateTime DayStartDateTime =sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[sc.Index]);
    int BarSessionStart = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, DayStartDateTime); // First bar of the day.

  //  float PercentSinceOpen = (sc.Close[sc.Index] - OpenValue) / OpenValue * 100.0f;

  //  float PercentSinceOpen = -1 * ((sc.Close[sc.Index] - sc.Open[0]) / sc.Open[0]) * 100.0f;
  //  float PercentSinceOpen = -1 * ((sc.Close[sc.Index] - sc.Open[0]) / sc.Close[sc.Index]) * 100.0f;
  //  float PercentSinceOpen = (sc.Open[0] - sc.Close[sc.Index] ) / sc.Close[sc.Index] * 100.0f;
  //  float PercentSinceOpen = 100 - (100 / (sc.Open[0] / sc.Close[sc.Index]));
  //  float PercentSinceOpen = -1* (100 - (100 / (sc.Open[BarSessionStart] / sc.Close[sc.Index])));
    float PercentSinceOpen = ((sc.Close[sc.Index] - sc.Open[BarSessionStart]) / sc.Open[BarSessionStart]) * 100.0f;
  //  float PercentSinceOpen = sc.Open[BarSessionStart];

These are my attempts to get it right, which are actually from the Docs (derivatives). The one but last line is the active one, from the Sierra23 attachment.
The last line already doesn't make sense (when active), BUT which could be related to the day's ending and starting. In Sierra23a you see the times which in my view are formally correct (Brussels' time), but which in no way resemble reality. Without screenshots (hard at this time, just in between days atm) trust me that the difference observed earlier tonight was between -0.76% which I regard realistic and -0.72% SC showed me by whatever means above. Of course, out of context, the BarSessionStart examples (above) are the only realistic ones, but with the notice that the others were derived from the PerCentSinceOpen Study and the OpenValue variable used in there. All to no avail.

If this is all to not having a correct Exchange feed (see other thread) then don't bother (but please confirm). But it is hard to imagine it is about that.

All seems related to P&L being all over the place from trade to trade, of which I hope to show tomorrow what bugs me.

General hint for you : I have the idea that it is not allowed to have two separate .cpp Studies for Trades and that P&L info line I show to you (AutoLoop regardless). The P&L line lags a Trade or something ...

I will subscribe for the next month tomorrow morning, so that can't be the problem (or haste).
Hey ... Thank you.
imageSierra23.png / V - Attached On 2019-01-15 22:54:57 UTC - Size: 19.21 KB - 229 views
imageSierra23a.png / V - Attached On 2019-01-15 23:03:20 UTC - Size: 24.62 KB - 224 views

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account