TRO Indicators - page 2

 

TRO MULTI METERS

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!!

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?

Thanks

Files:
 

reasons 4 not releasing source code always different and complicated

when other can put efforts into development, all the additional work (mods, derivatives, ets) - CJA always cool with it - and now so much requests to change one little detail after another out of his neck

plus the more different ways - the better

 

Thank you for sharing this superb stuff TheRumpledOne.

Cheers

Ethan Hunt

 
fxbs:
reasons 4 not releasing source code always different and complicated

when other can put efforts into development, all the additional work (mods, derivatives, ets) - CJA always cool with it - and now so much requests to change one little detail after another out of his neck

plus the more different ways - the better

If you are giving something away for free, no reason not to release the code. If you are selling the code, of course you want to keep it secret. IMO, the only other reason to keep code secret is so you are the WIZARD and everyone has to come grovelling to you.

My degree was in computer science (1977 BS Univ of Maryland) and over the decades fellow coders have helped me and I have helped fellow coders. Sometimes, someone can save you hours of frustration by showing you a simple technique.

I looked at code from Waddah, FerruFX and whoever wrote the !xMeter and learned a bunch. That's how I was able to write the TRO MULTI METERS so quickly. I took the code and made it more user and programmer friendly. Anyone can use my code as a template and can whip out their own meter in minutes. For example, to make a ROC or Momentum version, just take the RSI version, rename it, delete the RSI code and install the ROC or Momentum code.

The code for producing the meter doesn't have to be altered. The labels are inputs, as are the colors and levels. And the object names contain timestamps so the user doesn't have to worry about one indicator stepping on the others. I am using tricks I learned years ago. Yes, I punched cards in my day...LOL!!

I hope others benefit from this and I can't wait to see someone make improvements to the code.

 

HI rumpled One,

Thanks for the posts, but do you think you post those indicators seperately (not in a zip file) I'm having trouble getting them to open otherwise. Thanks!

 

Unzipped

There you go-

 

Here's the TRO_MULTI_METER_BLOCK.

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:

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;[/code]Then the function:

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

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 );

}[/code]And the function calls:

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]string LabelTime="";

if (LabelTime=="") {LabelTime=TimeToStr(TimeLocal(),TIME_SECONDS); }

And use that as part of the Object Names:

[code]

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!

 

Thanks Big Baloo and Rumpled One. Works awsome!

 
dahud1:
Thanks Big Baloo and Rumpled One. Works awsome!

Please post a chart or two showing us how you are using the TRO MULTI METERS.

And if you created your own meter, please share the code.

Thanks.

 

re tro delete problem......

This should delete your indicators...

int deinit()

{

//----

ObjectsDeleteAll(0,OBJ_HLINE);

ObjectsDeleteAll(0,OBJ_TEXT);

ObjectsDeleteAll(0,OBJ_LABEL);

deleteObject();

//----

return(0);

}

Xard777

It is good to share, it is also good to respects ones decision to keep his/hers own hard work private.

cja should keep his work private, but then again he should have stepped up to the plate and offered help with tro's delete problem.

Reason: