Hi,
I am trying to draw a horizontal lines at a fixed level with my indicator using the AddLevel function but 1) the double value always seems to truncate at 2 decimal places and 2) I dont see a line drawn on the chart when I add the indicator.
This is my code
double dBaseLine;
EXPORT void __stdcall Init()
{
IndicatorShortName("AbsFib");
SetOutputWindow(ow_ChartWindow);
RegOption("Highest Baseline Value", ot_Double, &dBaseLine);
AddLevel(dBaseLine, psSolid, 2, clRed);
}
If this is not the right way to draw a horizontal line on the chart can you give me an example of how this should be done.
Thanks,
Greg
How to draw a horizonal line
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
Hello,
You can only use constant levels in "Init" procedure because this procedure is called before the user can enter level value.
If you need to have dynamic levels then please use objects, for example:
See more info about objects in Forex Tester -> Help -> Indicators API
You can only use constant levels in "Init" procedure because this procedure is called before the user can enter level value.
If you need to have dynamic levels then please use objects, for example:
Code: Select all
EXPORT void __stdcall Calculate()
{
...
ObjectCreate('HLine', obj_HLine, 0, 0, Close(0));
...
}
See more info about objects in Forex Tester -> Help -> Indicators API
Check our other product here:
http://www.forexcopier.com
http://www.forexcopier.com
-
- Posts: 23
- Joined: Sun Jun 19, 2011 10:19 am
Hi,
Thanks for your help. I appreciate your time. I dont need dynamic hoizontal lines. I would just like to add static horizontal lines at a fixed prices on the chart in the Init method and they would remain at that level until the indicator is removed (or the chart window is closed).
Can I use AddLevel() to add a static horizontal line at a fixed price in the Init method of an indicator? If so can you tell from my code sample why 1) the double value always seems to truncate at 2 decimal places and 2) I dont see a line drawn on the chart when I add the indicator.
Or will I have to use Objectxxx methods to add these lines?
Thanks very much for your help,
Greg
Thanks for your help. I appreciate your time. I dont need dynamic hoizontal lines. I would just like to add static horizontal lines at a fixed prices on the chart in the Init method and they would remain at that level until the indicator is removed (or the chart window is closed).
Can I use AddLevel() to add a static horizontal line at a fixed price in the Init method of an indicator? If so can you tell from my code sample why 1) the double value always seems to truncate at 2 decimal places and 2) I dont see a line drawn on the chart when I add the indicator.
Or will I have to use Objectxxx methods to add these lines?
Thanks very much for your help,
Greg
-
- Posts: 905
- Joined: Sat Jul 11, 2009 10:54 am
Who is online
Users browsing this forum: No registered users and 11 guests