Download MetaTrader 5
To add comments, please log in or register
All activity of the MQL5.community members is displayed on a single page!
yellowlion
75
yellowlion 2014.02.20 08:14 

Hello all,

Hope everyone is enjoying the new platform as much as I am :)

I have a simple indicator that has stopped working under v600+. And the old v509 compiler will compile the Source File ok but the executable does not wanna play :)

Here is the code :)

//Blah Blah

#property indicator_chart_window

double sma8, sma21, sma200; //MA's

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

int init()
  {
   return(0);
  }

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

int deinit()
  {
   ObjectDelete("Label MAs");
   return(0);
  }

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

int start()
{

//Moving Averages for all charts

sma8 = iMA(NULL,0,8,0,MODE_SMA,PRICE_MEDIAN,0);
sma21 = iMA(NULL,0,21,0,MODE_SMA,PRICE_MEDIAN,0);
sma200 = iMA(NULL,0,200,0,MODE_SMA,PRICE_MEDIAN,0);

//caluclate hours and minutes until next bar change

int barhr = TimeHour(TimeCurrent()) - TimeHour(Time[0]);
int barmin = TimeMinute(TimeCurrent())-TimeMinute(Time[0]);

if(barmin<0) barmin = 60+barmin;

ObjectCreate("Label MAs", OBJ_LABEL ,0,0,0,0,0);
ObjectSet("Label MAs",OBJPROP_CORNER,0);
ObjectSet("Label MAs",OBJPROP_XDISTANCE,25);
ObjectSet("Label MAs",OBJPROP_YDISTANCE,0);
ObjectSetText("Label MAs" , "(8) " + DoubleToStr(sma8,4) + "  (21) " + DoubleToStr(sma21,4) + "  (200) " + DoubleToStr(sma200,4) + "   " + barmin, 7, "Tahoma", Black);

return(0);
}
//+------------------------------------------------------------------+

I'm just so silly, I can't figure out why this doesn't work in this marvelous new release :)

I've tried it so many different ways, I have those new MQL4 folders all over the place :)

Can anyone help dumb ol time constrained me? :)

Thanks much,

Yellowlion :)

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.20 09:13  
yellowlion:

Hello all,

Hope everyone is enjoying the new platform as much as I am :)

I have a simple indicator that has stopped working under v600+. And the old v509 compiler will compile the Source File ok but the executable does not wanna play :)


It does work, just adjust the Y position of the label a little, it too high so you can't see it. Did you check your chart for Objects ?
yellowlion
75
yellowlion 2014.02.20 09:17  

I have made progress :)

I put the v509 compiler in its own folder "509" in the Program Files location where terminal.exe and the new and improved metaeditor.exe is :)

I manually opened the 509 compiler and initially compiled an indicator in the AppData\nested ridiculously deep\ location :)

When compiling, the 509 compiler created it's own config and old mt4 experts folder in the 509 folder :)

The compiled source file stayed in the AppData\nested ridiculously deep\ location and had no effect on my charts :)

I then made a copy of the indicator I wished to work with copying both Source File and EX4 files from AppData\nested ridiculously deep\ into 509\experts\indicators and compiled that source file. :)

Both files compiled. :)

I then copied them back into the working AppData\nested ridiculously deep\ location. :)

That had no effect on my charts. BUT, all is not lost. :)

I closed the terminal and reopened it and Voila, there were the changes I made to the old mt4 code inoperable in the new and improved compiler :)

So far this is how I know to get the changes after compiling, copying. and pasting back. Doing that work with the terminal closed and re-opening it to see the changes. :)

I'm sure it is simpler than that and if anyone has a simpler process please let this time constrained dummy know :)

yellowlion
75
yellowlion 2014.02.20 09:19  
RaptorUK:
It does work, just adjust the Y position of the label a little, it too high so you can't see it. Did you check your chart for Objects ?

Yeah Raptor, I was trying to adjust the YDistance and was getting no results. My comment above is the progress I have made. The code is fine, it's just how to get the terminal to acknowledge my changes. It used to change on the fly when recompiled...it doesn't do that now with the copy and paste.

It wouldn't compile for me in the v600 editor. When I tried it it disappeared. What I would like to make disappear is the symbol and timeframe...that's clutter for me.

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.20 09:35  
yellowlion:

Yeah Raptor, I was trying to adjust the YDistance and was getting no results. My comment above is the progress I have made. The code is fine, it's just how to get the terminal to acknowledge my changes. It used to change on the fly when recompiled...it doesn't do that now with the copy and paste.

It wouldn't compile for me in the v600 editor. When I tried it it disappeared. What I would like to make disappear is the symbol and timeframe...that's clutter for me.

I keep all my code outside of the MT4 Terminal folder structure, I only copy it across when I want to test or run it. This is what I did with your code, the Terminal just needs restarting once when you copy the first version across, if you then make a coding change and copy across the new version you don't need to restart MT4.
/
To add comments, please log in or register