I wish to plot the results of each trade using a sharp indicator which I created. As the number of bars vary based on each trade I created the indicator and PlotSeries for the sharp ratio indicator in the scope of the trading loop sell conditions as follows:
CODE:
Please log in to see this code.
I'm aware that I shouldn't do this in the trading block of code as I have shown above. Where would I write this code and how?
Thank you
Size:
Color:
CODE:
Please log in to see this code.
Size:
Color:
Thank you Eugene.
Size:
Color:
Got interrupted.
Using .Series would lead to invalid results due to caching: the DataSeries would be only created once. So when populating such dynamic indicators, the idea is to call the .Value method (if available; most Community indicators do not implement it).
Size:
Color:
Eugene,
I used what you wrote and am getting satisfactory results. Is there anything glaringly wrong? Code below:
CODE:
Please log in to see this code.
Size:
Color:
Other than I don't see the connection of this incomplete code to the orignal task - perhaps no, nothing's wrong.
P.S. Keep in mind my comment in post #4.
Size:
Color:
I see that I pasted the wrong code. I'll send my example shortly.
Size:
Color:
Eugene,
I applied the above code to the following system. I've included a PDF of the resulting charts from your code and from my code. My example shows missing lines during some of the trades while your example has all bars during the trade showing the indicator. The good thing is that the sharp indicator is being displayed on the trades page. Can you tell why this is happening with the charts?
BTW The example that I mentioned in post #5 is on my home PC. I'm away from home and using my laptop. I just created the following system a moment ago.
CODE:
Please log in to see this code.
Size:
Color:
Mike, you can (and should) troubleshoot your code yourself. The QuickRef has an example on how to use PrintDebug, the simplest troubleshooting tool available. When you learn to insert it into your code (or an alternative like AnnotateBar), you're going to notice the value at a given bar. In short, what you'll probably find is that the indicator value at such bars is invalid and therefore is assigned a zero.
Size:
Color:
Eugene,
I haven't used the Print Debug tool. Even using the example give in quick ref, I'm not sure how to apply it or how to interpret it. As for this example, where would I write PrintDebug? I have an example code and debug log pdf attached
Size:
Color:
I would insert PrintDebug right after the code finishes assigning the indicator value.
Size:
Color:
In addition, please explain
CODE:
Please log in to see this code.
I don't know what this means exactly.
Also, why in certain cases the indicator is assigned a 0 in my example case, while in your example no such case occurs?
Size:
Color:
Mikes.. these are browser search questions. Google double.IsInfinity, for example. Repeat for double.IsNaN.
Size:
Color:
QUOTE:
Also, why in certain cases the indicator is assigned a 0 in my example case, while in your example no such case occurs?
Since this is
your indicator, understanding and troubleshooting it is yours.
Size:
Color:
Thanks Robert and Eugene. I will search Google accordingly. Eugene, I am trying to get a handle on it. I wouldn't have arrived at it if it wasn't for your generous offering of the code. Now I'm playing catch up to understand how it work and why it doesn't under different circumstances. Perhaps after I have a good grip on .IsInfinity and .IsNaN ,I might be able to answer my own question. I hope.
You guys, have a great rest of your weekend.
Size:
Color: