[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 316

 
gyfto:

The other indicator on #property indicator_chart_window via iCustom, and there on DRAW_ARROW.

is there another way? or could you give me a link where this case is implemented, maybe you've encountered this...

 
Zhunko:

Does the test script from the kit work?


Yes, it did, it worked out.

Zhunko:

There are a lot of syntax errors.
Strange... Maybe MetaEditor is reacting that way to Greek? At least everything compiles with me...
 
gyfto:


Let me try it now. When we write

then in all cases these some actions will always be performed, because the first two are similar to the third (check, simplify the expression). That is, if they are boolean variables, we don't need to put ==true, ==false, because they are already true or false by themselves.


Got it, thanks! Sorry about the off-top. I subscribed to this thread in my profile and indicated to report replies to my email. But for some reason I am not notified of replies. How can I solve this issue?
 
clubsmi:

Is there another way? Or could you give me a link where this is done, maybe you've seen it before...


No, I didn't use iCustom at the time because I didn't know about it at the time. Here are two examples, one and the same algorithm, only one is in a subwindow and the other is signal at the intersection of the first one.
Files:
sst_alert.mq4  3 kb
sst_line.mq4  2 kb
 
gyfto:


Yeah, it's working, it's working.

That's weird... Maybe MetaEditor's reacting to the Greek? At least everything compiles with me...

That's a relief. So we have to look for errors in the code.

Yeah. The Greek characters are showing up for some reason.

 
alsu:

If it's a script and it's in the scpirts folder, then it's been run once and removed from the chart. To keep it permanently, put your code inside this



By "script" I meant the algorithm.

So can someone help me with the algorithm?

I want to trigger an Alert when the market is open and similarly when the market is closed and trading has stopped Alert that the market has closed!

 
I think I've figured out the reason. The TF is a second one with gaps, so I tried to form an additional one-dimensional array of indices where each element a "right number of seconds ago" corresponds to the element b "index of this candle in a second TF with gaps". The required index value is then calculated using the formula n(x)=ind[final]-ind[final-x]+1. But since this TF is not synchronized yet, unlike minutes, which are automatically downloaded if the terminal is started again after closing a few minutes ago, for example, Δt per sec. TF will sometimes be abnormally large, and this is what determines the resizing of the additional array, i.e. Δt of cells are filled with the same value (index of this bar). In this case just MemoryWrite, MemoryRead goes off the scale. The way out, in principle, is "simple": start sec. TF on VPS, and synchronize with it if terminal is opened again after short period of closing. More realistically, it's better to put off working with the library until Monday, and on Monday start building this extra array live on real-time. Or go straight from your computer to the VPS, and shape it there.
 
pasha5282:

By "script" I mean an algorithm.

so can someone help me with the algorithm?

When the market opens Alert that the market opened and similarly when the market closed and trading stopped Alert that the market closed!


I don't know, Pasha, to be honest, I don't understand what's wrong. It's not a script, but a piece of code, right? Try to put brackets around it to ease your conscience:

      if((DayOfWeek()==1) && (Hour()==0) && (Minute()==0) && (Seconds()==1)) Alert("Рынок открылся.");
      if((DayOfWeek()==5) && (Hour()==23) && (Minute()==59) && (Seconds()==59)) Alert("Рынок закрылся.");
 
чтобы при открытии рынка срабатывал Alert что рынок открылся, и аналогично когда рынок закрылся и торговля прекратилась Alert что рынок закрылся!
bool Opened=false;
...
int start()
if( !MarketInfo(Symbol(), MODE_TRADEALLOWED) ){
   if( Opened ){
   Alert("Рынок закрылся.");
   Opened=false;
}  }
else{
   if( !Opened ){
   Alert("Рынок открылся.");
   Opened=true;
}  }
 

How can I simplify this expression?

is from the ADX algorithm by MetaQuotes. MetaQuotes themselves use this expression:

if(pdm<0) pdm=0;
if(mdm<0) mdm=0;
if(pdm==mdm) { pdm=0; mdm=0; }
  else if(pdm<mdm) pdm=0;
    else if(mdm<pdm) mdm=0;

- how to simplify it? From Wiki,

, here I consider as the same function, only with different input parameters.