void start () problem

 

Hello,


I have a EA that uses void Start () and runs ok on local desktop. It only goes round on every tick if placed on a VPS.

I tried replacing void Start with void OnStart() but the problem stays the same.

What should I use instead of void Start() and void OnStart() to have my EA go arround permanently and not only at every tick ?

 

Dear Nico


To my knowledge it is not possible, if u use void Start() then it is converted automatically to OnTick since its an EA! Only scripts uses OnStart and EA use OnTick!

https://docs.mql4.com/basis/function/events

but if you tell us why u want the EA to goes everytim not just on tick maybe we can help ya better

Onarius

Event Handling Functions - Functions - Language Basics - MQL4 Reference
Event Handling Functions - Functions - Language Basics - MQL4 Reference
  • docs.mql4.com
The MQL4 language provides processing of some predefined events. Functions for handling these events must be defined in a MQL4 program; function name, return type, composition of parameters (if there are any) and their types must strictly conform to the description of the event handler function. The event handler of the client terminal...
 

Onarius,

The EA checks the opened orders and when the total of all opened orders reaches a certain amount, it closes the orders and opens new ones. This check must be performed continuously and not only every 15minutes when I'm on a M15 chart.

 
Nico1854: This check must be performed continuously and not only every 15minutes when I'm on a M15 chart.

Then put the code in OnTick/Start and it will be called each tick. The timeframe of the chart is irrelevant.

Nico1854:

I have a EA that uses void Start () and runs ok on local desktop. It only goes round on every tick if placed on a VPS.

I tried replacing void Start with void OnStart() but the problem stays the same.

What should I use instead of void Start() and void OnStart() to have my EA go arround permanently and not only at every tick ?

OnStart is only for scripts. Not for EAs or indicators. For EAs use OnTick or start. For indicators use OnCalculate or start.

You don't have to do anything "continuously." Nothing is changing until a new tick arrives. Return and wait for the next tick.

There is no void start().

 

I don't know what to change,


As I said, the EA works fine with void Start() on my local computer. As soon as the amount is reached, the orders are cashed in. It's only when the EA runs on MT4 VPS that it only cashes in every 15 minutes when on M15 (if condition is still ok).

 
Nico1854: EA works fine with void Start() on my local computer. It's only when the EA runs on MT4 VPS that it only cashes in every 15 minutes when on M15 (if condition is still ok).
  1. There is no void Start() There is a int start() and int OnTick()
  2. local or VPS is the same, start runs once per tick.
  3. Then that is how it is coded, to look for a new bar. Change your code.
 

    Start is deprecated, OnTick() function is instead. But... what do you mean EA go around permantently not at every tick... your EA is running orders or not depending the tick volume and what is set in your EA as variables and functions 

 

My mistake,

Sorry for that but yes, the EA runs arround on every Tick and not permanently as I thougth.

Thank you all for taking the time to help me out.

Reason: