Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 07:12:02 +0000



Post From: Divergence Line Drawing

[2015-02-13 05:58:32]
CustomIndicators - Posts: 126
Making a divergence indicator, I'm having a little trouble getting the lines to draw.

There are persistent variables correctly holding DateTime data, and persistent variables correctly holding indicator values. I know this, as one of the other drawings, is using the variables to draw correctly.

/* ********************** START OF CODE ********************** */
// These persistent variables have been correctly filled in another part of the code.

float& peakOne = sc.PersistVars->f1;
SCDateTime& peakOneDT = sc.PersistVars->scdt1;
float& peakTwo = sc.PersistVars->f2;
SCDateTime& peakTwoDT = sc.PersistVars->scdt2;

s_UseTool Divergence;

Divergence.Clear();
Divergence.ChartNumber = 1;
Divergence.AddMethod = UTAM_ADD_OR_ADJUST;
Divergence.LineNumber = 852739;
Divergence.DrawingType = DRAWING_LINE;
Divergence.Color = RGB(0,255,0); // Red,Green,Blue
Divergence.LineWidth = 1;
Divergence.BeginDateTime = peakTwoDT;
Divergence.BeginValue = peakTwo;
Divergence.EndDateTime = peakOneDT;
Divergence.EndValue = peakOne;

// Just so I know for sure that the peakOne and peakTwo have the correct values, I had them show up in the log.
// They both correctly showed up in the log.
// The same was done for the SCDateTime pers vars, and they also came up with the correct DateTimes.

SCString BufferPOne;
BufferPOne.Format("Peak 1: %f", peakOne);
sc.AddMessageToLog(BufferPOne, 0);

SCString BufferPTwo;
BufferPTwo.Format("Peak 2: %f", peakTwo);
sc.AddMessageToLog(BufferPTwo, 0);

sc.UseTool(Divergence);

// So far, the code doesn't show any lines.
/* ********************** END OF CODE ********************** */

Any ideas as to how I can get this to work properly?