TRO MULTI METERS

free & uncensored discussion arena for TheRumpledOne

Moderator: moderators

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 15538
Joined: Sun May 14, 2006 9:31 pm
Reputation: 3035
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

TRO MULTI METERS

Postby TheRumpledOne » Sun Dec 30, 2007 3:07 am

TRO MULTI METERS

Image

The TRO MULTI METERS allow the user to build their own meters.

_TRO_MULTI_METER_BLOCK is the building block.

I built MACD, RSI, and EMA CROSSOVER meters for you.

Let's see what you can build!!

Each line is an indicator. The user input Shift_UP_DN allows to you raise/lower the indicator on the screen. You can load more than one copy of the indicator on the chart.

In the example, I have these indicators loaded:

TRO MULTI METER BLOCK
TRO MULTI METER MACROSSOVER set to ema(1) x ema(5)
TRO MULTI METER MACROSSOVER set to ema(13) x ema(26)
TRO MULTI METER MACD
TRO MULTI METER RSI

You can just keep on adding!!

When you want to build a new indicator, use TRO MULTI METER BLOCK or any of the others as a template. Don't worry about the object names because I use time as part of the object name... they shouldn't step on each other.

We can have a complete library of meters for all to use.

But I need a little help... I am new to MT4 and don't know how to get the object to delete when you delete the indicator. Can anyone fix this?


[color=red]UPDATE DEC 30, 2007[/color]

Fixed the object delete problem.

Updates can be found on the MT4 THREAD. I deleted the attachment on this thread.
Last edited by TheRumpledOne on Sun Dec 30, 2007 7:38 pm, edited 1 time in total.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!

Please do NOT PM me with trading or coding questions, post them in a thread.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 15538
Joined: Sun May 14, 2006 9:31 pm
Reputation: 3035
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sun Dec 30, 2007 4:43 pm

TRO_MULTI_METER_BLOCK: Here's how it works.

It's the one you can use to build your own indicator.

The RSI version has a MeterColor function. First part are the inputs that allow the user to set the levels and colors:


Code: Select all

extern double Level5 =  95 ;
extern double Level4 =  80 ;
extern double Level3 =  50 ;
extern double Level2 =  20 ;
extern double Level1 =  5 ;
extern double Level0 =  0 ;

extern color colorLevel5 =  Red ;
extern color colorLevel4 =  Orange ;
extern color colorLevel3 =  Yellow  ;
extern color colorLevel2 =  YellowGreen ;
extern color colorLevel1 =  Blue ;
extern color colorLevel0 =  DarkBlue;
Then the function:

Code: Select all

//+---------------

color MeterColor( double rsimeter )
{
if( rsimeter > Level5 ) { return( colorLevel5 ); }
if( rsimeter > Level4 ) { return( colorLevel4 ); }
if( rsimeter > Level3 ) { return( colorLevel3 ); }
if( rsimeter > Level2 ) { return( colorLevel2 ); }
if( rsimeter > Level1 ) { return( colorLevel1 ); }
return( colorLevel0 ); 
}
And the function calls:


Code: Select all

M1_RSI= "-";  color_RSIm1    = MeterColor( rsi_1 ) ;
M5_RSI= "-";  color_RSIm5    = MeterColor( rsi_5 ) ;
M15_RSI= "-"; color_RSIm15   = MeterColor( rsi_15 ) ;
M30_RSI= "-"; color_RSIm30   = MeterColor( rsi_30) ;
H1_RSI= "-";  color_RSIm60   = MeterColor( rsi_60) ;
H4_RSI= "-";  color_RSIm240  = MeterColor( rsi_240) ;
D1_RSI= "-";  color_RSIm1440 = MeterColor( rsi_1440) ;
This saves a bunch of redundant coding.


Another trick I used is in the Object Names. I initialize a string variable:


Code: Select all

string LabelTime="";


if (LabelTime=="") {LabelTime=TimeToStr(TimeLocal(),TIME_SECONDS); }
And use that as part of the Object Names:


Code: Select all

   string Obj0002 = "SignalRSIM1t" + LabelTime ;
         
   ObjectCreate(Obj0002, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0002,IndName, 7, "Tahoma Narrow",  BarLabel_color); 
   ObjectSet(Obj0002, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0002, OBJPROP_XDISTANCE, 155+Adjust_Side_to_side);
   ObjectSet(Obj0002, OBJPROP_YDISTANCE, 50+Shift_UP_DN);
So much easier to handle the code when literals are stored in string variables and code is in fucntions and/or subroutines. That way you only have to make ONE change.

It looks like I need to do the same with the font and font size in the next version.

As you can see, the TRO MULTI METERs are really very simple programs that give the user all the flexibility they need to build their own displays.

Can anyone help me get the objects to delete properly? Thanks!
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!



Please do NOT PM me with trading or coding questions, post them in a thread.


Return to “TheRumpledOne”