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

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
I understand that! But how can we program this variable ("specified spread")? Sure, I can create a variable Spread and change it every time I change the spread in the tester. Say, Spread(TestGenerator) or there's some function, or you can somehow make such a function, it can't be that you can't! А?
There is a set spread, when testing,
but with most DCs it is variable. If you want, take it into account in the tester. In general, test the Expert Advisors at the most unfavourable conditions. I.e. with maximal spread, with possible delays in order opening, etc.
There is a specified spread, when testing,
but with most DCs it is variable. If you want, take it into account in the tester. In general, test the Expert Advisors at the most unfavourable conditions. I.e. with maximal spread, with possible delays in order opening, etc.
Here is the function
bool isFlagHistoryPos(int mn=-1) {
datetime t;
int gd = MarketInfo(Symbol(),MODE_DIGITS);
int i, j=-1, k=OrdersHistoryTotal();
for (i=0; i<k; i++) {
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol()==Symbol()) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderCloseTime()) {
t=OrderCloseTime();
j=i;
}
}
}
}
}
}
if(OrderSelect(j, SELECT_BY_POS,MODE_HISTORY)) {
double ocp=NormalizeDouble(OrderClosePrice(),gd);
double otp=NormalizeDouble(OrderTakeProfit(),gd);
if(MathAbs(ocp-otp)/Point<=TPpoint) return(true);
}
return(false);
The Expert Advisor itself is attached
/* Decompiled by Vinin */
Yes I understand and do everything! Just wanted the spread I'm setting to be reflected in the prog, as Ask is often distorted in the tester, then find it via Bid+spread! See branch MarketInfo does not work in the tester! Then you'll know what's wrong! Asked there, and no one! Therefore moved here, there responded, for which you and others thank you!
Shit, Boris. I've written before. Well, you can imitate a floating spread right in the Expert Advisor. What prevents me from adding a random number in the floating spread's range to the bid, and open it with stop orders. And close by value, not by stop orders. It's more complicated than just setting a larger static spread, but if you really need it, you can do it. At the same time set the minimum spread in the tester.
It's just that... a line of thought.
Shit, Boris. I've written before. Well, make a simulated floating spread right in your EA. What's stopping you from adding a random number in the floating spread range to the bid and opening with stop orders. And close by value, not by stop orders. It's more complicated than just setting a larger static spread, but if you really need it, you can do it. At the same time, in the tester, set the minimum spread.
This is just ... A way of thinking.
Help with the problem, please) I wrote an Expert Advisor that works by crossing waving, but when I try to test it, the terminal beeps and does not test anything (compiler code likes it. How to make it at least something to show?
Help with the problem, please) I wrote an Expert Advisor that works by crossing waving, but when I try to test it, the terminal beeps and does not test anything (compiler code likes it. How to make it at least something to show?
Something tells me that "this is where the problem lies":
Help with the problem, please) I wrote an Expert Advisor that works on crossing waving, but when I try to test it, the terminal beeps and does not test anything (compiler code likes. How to make it so that he at least something to show?
//считаю ордера чтобы советник не трогал в ручную выставленные ордера
Where will he touch it? Yes and it is enough to check the magician, manual without magician.
And, as written above, the mashes don't overlap...
Here's the function
The advisor itself is attached
Strange variable names, the decompiler does that)))