Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 644

 
Artyom Trishkin:

datetime is ulong

Thank you very much!
 
Vitaly Gorbunov:

You should not have corrected his code at once, the man just does not understand elementary compiler keys, and to write a normal code you need to know these subtleties and use documentation!

I pointed out the antiquity of the video and if he copied it exactly as it was in the video he would succeed. But he took offense and complained about the post, which resulted in its deletion, while he himself is not even going to look into it!

It turns out it wasn't entirely for nothing. He hasn't even tried to understand the difference in the submitted code and it doesn't even work that way.

Generally, I don't like to prompt with code corrections either. But here it turned out to be "not the case". I have been interested in libraries for a long time, even had my own library. But having understood that I have to pass the entire library together with the Expert Advisor or indicator code, and explain what to put there... Not everyone understands this at once, I decided to give it up. This is an answer to the retort

And in order to fix it, I had to sort it out and remember what I had forgotten. That left me with the finished code.
 
Sergey Maksiutenko:

Don't bother.

I understand that you can't help me.

I've removed #property strict, I've removed all properties except#propertylibrary

doesn't help.

Try plugging in my design, find the error,

and post the correct code, if this is the problem.

Forum on trading, automated trading systems and strategy tester

Any MQL4 beginners questions, help and discussion on algorithms and codes

Alexey Viktorov, 2018.10.03 11:56


I've already tried to use this trading strategy as an example and I've managed to implement it myself. That left me with a finished code.
There's a working code that's ready to go.
 
Ha, I figured out the problem! I wonder why everything works for me and not for him! If he shows me which files are in his \Include \Libraries \Experts \Scripts, maybe we can even file an error in the Service Desk!
 
Sergey Maksiutenko Well, I'm ready to post the contents of the right folders, otherwise I'll consider you a troll! Because I managed to reproduce this problem and I know what's wrong with you!
 

I'm sitting on XP, MT4 1090 and it follows that I won't have any updates.

When I change time scale in MT4the chart constantly moves to the left or right - if I switch from a bigger scale to a smaller one (e.g. from daily to hourly) the data is half a year old on the screen. If I switch from a smaller to a bigger scale, it shows only the last 10 candlesticks. I have to perform constant gestures to make the chart look acceptable, which is annoying.

For your convenience, I have written a code that switches the scale on the keyboard and shifts the chart to the end:


void OnChartEvent(const int id,

const long &lparam,

const double &dparam,

const string &sparam)

{

string Key1_Value="1";

string Key2_Value="2";

string Key3_Value="3";


if(StringGetChar(Key1_Value,0)==lparam)

ChartSetSymbolPeriod(0,NULL,5);

if(StringGetChar(Key2_Value,0)==lparam)

ChartSetSymbolPeriod(0,NULL,60);

if(StringGetChar(Key3_Value,0)==lparam)

ChartSetSymbolPeriod(0,NULL,1440);

ChartNavigate(0,CHART_END,0);

}


Everything works, but ChartNavigate "freezes" the chart in place and won't let it scroll to the left. How to fix it?

 
psyman:

I'm sitting on XP, MT4 1090 and it follows that I won't have any updates.

When I change time scale in MT4the chart constantly moves to the left or right - if I switch from a bigger scale to a smaller one (e.g. from daily to hourly) the data is half a year old on the screen. If I switch from a smaller to a bigger scale, it shows only the last 10 candlesticks. I have to perform constant gestures to make the chart look acceptable, which is annoying.

For the sake of convenience, I have written a code to switch the scale on the keyboard and shift the chart to the end:

There's a button there to make the chart shift itself.

1

 


If I want to draw a trendline, the autoscroll does not allow to scroll the chart leftwards.

Especially since it only works when new ticks come in.

 
psyman:


Auto-scrolling prevents the chart from scrolling to the left if, for example, a trend line needs to be plotted.

Especially since it only works when new ticks come in.

then like this

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
if (id==CHARTEVENT_KEYDOWN)
   {
   if(lparam=='1')
      ChartSetSymbolPeriod(0,_Symbol,PERIOD_M5);

   if(lparam=='2')
      ChartSetSymbolPeriod(0,_Symbol,PERIOD_H1);

   if(lparam=='3')
      ChartSetSymbolPeriod(0,_Symbol,PERIOD_D1);

    ChartNavigate(0,CHART_END,0);
   }
}
 
Thank you very much.
Reason: