[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 614
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
MathRand should be initialized with MathSrand() before use,
and I recommend passing TimeLocal() as a parameter of MathSrand().
Initialization is required once, then for 32768 queries MathRand() is not detected,
After that you can initialize again if you want a new sequence, otherwise the same thing happens.
You can of course initialize each step, but you need to monitor initialization parameter to change,
otherwise it's the same sequence.
That's what I do. What is timelockal?
I have the same set on the same story.
That's what I do. What is timelockal?
I have the same set on the same story.
Examples from the textbook:
datetime TimeLocal()
The function returns local computer time as the number of seconds elapsed since 00:00 on January 1, 1970.
Note: when tested, the local time is simulated and matches the simulated last known server time.
COULD SOMEONE PLEASE ADVISE. ...AccountEquity() ONE BAR ABOVE (on a past bar) HOW TO WRITE?
Answer: no way.
AccountEquity() returns the amount of equity, and does not depend on the number of bars.
You cannot know its previous values simply by rolling back the history of bars.
Its value depends on the number of open/closed, profitable/loss-making trades.
To record the "history of equity", create a static array and record the AccountEquity() value into it, for example, at every bar opening.
Thus, we would need to scroll through the array to obtain the history of equity changes.
SOMEBODY GIVE ME A HINT... AccountEquity() ONE BAR ABOVE (on a past bar) HOW TO WRITE?
It looks like we need to store it on each new bar in a variable, for example in this way:
1. store the initial equity value in the init() function in a variable, say EquAkk=AccountEquity();
2. check appearance of a new bar ( not in init of course), if yes, then
{
LastEqu=EquAkk; // store the past (required by us) equity value in the variable
EquAkk=AccountEquity(); // record the new equity value (for the next "past" value)
}
Thus, the LastEqu variable will store equity value for the past bar, and its value will be overwritten again as the next bar is opened...
... I wrote it on my own, didn't check it, and I fell asleep already, so don't kick me too much...
I think I've expressed the idea ....
Answer: no way.
AccountEquity() returns the amount of equity, and does not depend on the number of bars.
You cannot know its previous values simply by rolling back the history of bars.
Its value depends on the number of open/closed, profitable/loss-making trades.
To record the "history of equity", create a static array and record the AccountEquity() value into it, for example, at every bar opening.
Accordingly, it would be possible to obtain the history of equity changes by scrolling the array.
SO, YOU CAN STILL
Well, I wrote the same thing but suggested using an array instead of a variable.
To record the "history of equity", you need, for example, to create a static array and record the value of AccountEquity() in it, for example, at the opening of each bar.
Accordingly, the history of equity changes should be obtained by scrolling the array.
Could you tell me, is it possible to open a position on a stop in MT? For example, put a stop behind support/sopr. and if it penetrates, the stop opens a position.
Sure. Only it is not called a stop but a pending order. Open your terminal. Press F1 in it. In the window that appears open Contents - Trade - Order Type.