Plot Balance curves

Posted By: krlitoos

Plot Balance curves - 01/11/19 08:39

Hello everyone,

After reading the article of White's Reality Check I decided to play a little bit with the code to improve my knowlodge of C-Lite and Zorro.

I'm trying to adapt the script to plot the curves rather than the histogram with the profit factors. It seemed easy but I've been struggling with the code without success.

To simplify the problem I decided to just plot the best performer curve.

Here are some of the modifications that I've tryied:

Code:
void main()
{
  byte *Content = file_content("Log\TrendDaily.bin");
  int i,j,N = 0;
  int MaxN = 0;
  var MaxPerf = 0.0;
	
  while(N<900 && *Content)
  {
// extract the next curve from the file
    ...

// store and plot the curve		
    ...
    //_plotHistogram("Profit",Performance,0.005,RED); // Comment this line
	
// find the best curve		
    ...
  }
  
// NEW: Plot best curve 
  plot("Profit",Curve[MaxN].Values,LINE,BLACK); // Doesn't work.
}


As the chart doesn't show anything I thought that maybe I should plot the values inside the run function, so I modified the code to:

Code:
void run()
{
	set(PLOTNOW);
	if(is(INITRUN))
	{
		// Read all curves code
		byte *Content = file_content("Log\TrendDaily.bin");
		int i,j,N = 0;
		int MaxN = 0;
		var MaxPerf = 0.0;
		...
	}
// NEW: Plot best curve. In this case the Values are always 0
	plot("Profit",Curve[MaxN].Values,LINE,BLACK); 
	
}


And this code produces a chart with Dates in the x-axis but not the balance.
Any advice or idea will be a big help.
Thanks
Posted By: Petra

Re: Plot Balance curves - 01/13/19 02:17

Your script does not show what youre plotting, but the plot call itself looks already wrong, seems youre only plotting the first value. A curve is made from many different values, one for any bar, like Curve[MaxN].Values[Bar] or so.
Posted By: krlitoos

Re: Plot Balance curves - 01/13/19 23:26

With the following code inside the run function:
Code:
plot("Profit",Curve[MaxN].Values[Bar],LINE,BLACK);


I receive the following message:
Quote:
Syntax error: Wrong type CONV:POINTER::DOUBLE
© 2024 lite-C Forums