View Single Post
Old 07-02-2013, 03:27 AM   #7
Senior Member
Join Date: Apr 2009
Posts: 294
Thanks: 7
Thanked 29 times in 16 posts
Default Dynamic number of plots and ribbon average - see attached.

Well, this thread is inactive more than 2 years, but I found a solution.
There is no problem to create requested nr of plots in Initialize() , without hardcoding, and Add(new Plot(... can receive any computed arguments.
My workaround to overcome a problem of only default input values available during Initialize() is to read them from external file. This solution has its limitation - you should edit the input file in external editor everytime before you need to change input values, and you cannot change file path the input values are read from. I can live with it, i'm not sure if others can.
An alternative could be to create custom form for supplying input values during Initialize() , I prefer not to do it, as I feel it may interfere with the framework.

May be, polymorphism mechanism used in OnStartUp() is worth attention either. It saves a lot of hardcoding.

I'm attaching example input file.
Order of parameters is: Average type, low average,high average , step , opacity , saturation, luminosity.

Please pay attention that the only known average types in my code are: SMA,EMA,WMA and HMA. Of course, it's possible to add other indicators, in the switch statement in OnStartUp() . On default, nothing is done and you'll see an empty indicator. I didn't implement an exception, as framework has an exception of its own.

The last 3 parameters are not relevant for RMMA, They allow to play with rainbow blends.

I'm using 256 bars dataseries, therefore there is a limit to high average is : < 254.

Eventually, credits should be given to a person, who created original RMMA.

Attachments: a code, input file and 2 screenshots
Attached Images
File Type: jpg rmmav2screen(1).jpg (174.5 KB, 135 views)
File Type: jpg rmmav2screen(2).jpg (177.3 KB, 97 views)
Attached Files
File Type: cs RMMAv2.cs (11.4 KB, 111 views)
File Type: txt RMMAv2.txt (24 Bytes, 94 views)
xTrader1 is offline  
Reply With Quote
The following 4 users say thank you to xTrader1 for this post: