Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 673

 

Hello. Can someone show me how to insert Comment(TimeToStr(TimeLocal(),TIME_SECONDS));

I got it or time (local) is updated only with a new tick (our Internet is bad), or time is correct and the Expert Advisor stops working

 
Irina_:

Hello. Can someone show me how to insert Comment(TimeToStr(TimeLocal(),TIME_SECONDS));

I got it or time (local) is updated only with a new tick (our Internet is bad), or time is correct and the Expert Advisor stops working


You should write the clock in OnTimer() to avoid dependence on ticks.
 

I've never used OnTimer() before .What would it look like? I'm a beginner.

Now I've done it like this:


int start()

{ here's the owl code

- - - - - - - - - - - - - - - -

at the end I put :

while(!IsStopped())

{

Comment(TimeToStr(TimeLocal(),TIME_SECONDS) +""+TimeToStr(TimeCurrent(),TIME_SECONDS) )

}

return(0);

}

It seems to show, but the comment appears on the chart some time later, after 15 minutes, when the EA has already opened a couple of orders. Why?

 
Irina_:

I've never used OnTimer() before .What would it look like? I'm a beginner.

Now I've done it like this:


int start()

{ here's the owl code

- - - - - - - - - - - - - - - -

at the end I put :

while(!IsStopped())

{

Comment(TimeToStr(TimeLocal(),TIME_SECONDS) +""+TimeToStr(TimeCurrent(),TIME_SECONDS) )

}

return(0);

}

It seems to show, but the comment appears on the chart some time later, after 15 minutes, when the EA has already opened a couple of orders. Why?


int OnInit()
{

EventSetTimer(нужное количество секунд);
   




   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   EventKillTimer();
   



}
//+------------------------------------------------------------------+
void OnTick()
{

   
}
//+------------------------------------------------------------------+
void OnTimer()
{


Comment(TimeToStr(TimeLocal(),TIME_SECONDS));
} //+------------------------------------------------------------------+
 
Thanks, I'll try it.
 
vadynik:

In order not to lose value you need a global variable, move its declaration outside ofOnTick() or make it static
You don't need to move it outside the global scope and make it static. Inside the function. Next to position_exists.
 
simpleton:
There is no need to take it out and make it global, it is enough to make it static. Inside the function. Next to position_exists.

So, what did I write? OR
 
rusa:
Do EAs from Metatrader 4 work in the android terminal?
No. There is no provision for EAs there at all.
 
Mr.Profit:

It turns out that SymbolSelect("AUDUSD", true) returns true only if AUDUSD is not in MarketWatch - i.e. when the pair is added to MarketWatch. Once the pair is in MarketWatch, subsequent calls return false.

This behavior does not match the manual of this function at all.

I had to use a self-written function which scans allSymbolName(i, true) for i=0...SymbolsTotal(true).

Everything fits.

The second parameter in the function is a switch.

1. If you send true, then you have to select symbol in Market Watch.

1.1.If it's not already there, it will be selected and the function will return true.

1.2. If it is already there, the function will not work (nothing to select) and will return false.

2. If you send false, then the symbol should be removed from the Market Watch.

2.1 If it is there, and there are no open charts and/or open positions for this symbol, then the symbol will be removed from the Market Watch and the function will return true.

2.2 If it is present, but there are open charts with this symbol and/or there are open positions with it, the function will not work and will return false.

2.3 If it is not there, the function will not work (there is nothing to remove) and returns false.

It goes like this...

 

Question for the knowledgeable . I have a problem with error 129. I developed the system as a programmer with one person as the engine of ideas. I don't understand if he and I trade at two different brokers on instant execution accounts. I get error 129 all the time. His trades are either at requote or at normal entry. I keep getting the 129 error (wrong prices). I don't know how it may be so when one and the same Expert Advisor earns money and I get a 129 error all the time. I feel sorry for him, I had to program this EA and my orders are not opening and he is making a profit. What is the problem? I'm getting some kind of nonsense.

PS: NormalizeDouble (Lot,lotdigits),NormalizeDouble(Ask,Digits),NormalizeDouble(deviation1-BU_Start-delta_spred,0),0,0,",Magic,0,Blue);

Reason: