[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 572

 
Vinin >>:

Надо бы контроль на стоплевел делать однако. Имхо.
My stop is not fixed. It is calculated based on hourly chart, so there is a normal margin. That's not even the point, I set a fixed stop of 200, 300, 400 pips (just to check) and still the error is 130...
 
Noterday >>:
У меня стоп не фиксированный. Расчитывается исходя из часового графика, так что там запас нормальный. Да даже дело не в этом, ставлю фиксированный стоп 200, 300, 400 пунктов (ради проверки) и всё равно ошибка 130...
Same thing... I'm using Igor Kim's functions. While I was stupidly using the simplest ones from the tutorial, everything was OK. I put in KimIV's and everything went wrong... Error 130 all the time. Five attempts to open with a stop and a take, and then there is an open order without any stops or take. And when a trailing stop (also from Igor) triggers, stops are set without any problems... Because of this I cannot properly test the strategy... Without stops it plummets, with trailing stop it cuts off profit...
 
Urain >>:

sy=Symbol();// ????????  sy обьявлен как неизменяемый параметр int Trend_MACD(string& sy,int tf)

What's that about? Is there something wrong? Explain, please...

 
artmedia70 писал(а) >>
Same thing... Using Igor Kim's functions. While I was stupidly using the simplest ones from the tutorial, everything was OK. Put KimIV's and everything went wrong... Error 130 all the time. Five attempts to open with a stop and a take, and then there is an open order without any stops or take. And when a trailing stop (also from Igor) triggers, stops are set without any problems... Because of this I cannot properly test the strategy... Without stops it plummets, with trailing stop it cuts off profit...

The problem seems to be in Slippage. It is small.
 
artmedia70 >>:

Это о чём? Что-то не так? Поясните, плиззз...

When you declare a function, you declare the sy parameter as immutable

int Trend_MACD(string sy,int tf)

and then you try to assign a value to this unchanged parameter in the function body

sy=Symbol();

this is the error, if you want to change it, you must declare it as variable.

int Trend_MACD(string& sy,int tf)

The problem is the "&" sign when declaring a function.

 

Hi all, may someone have a piece of code with the following algorithm:

If last closed trade is unprofitable and there is no open position with mag=12345, then Lot=2*lot.

 
dmitriy086 писал(а) >>

Hi all, may someone have a piece of code with the following algorithm:

if last closed trade is unprofitable and there is no open position with magic=12345, then Lot=2*lot.


Search for EAs with the word "martin" or "martingale".
 
Roger >>:

Поиск тебе в помощь, ищи советнки со словом "мартин" или "мартингейл".

This is too simple, we are not looking for easy ways)))), I have searched a lot (but I'm not a programmer), I can not determine where and how, what, so I ask for a ready-made piece.
 
Urain >>:

При обьявлении функции вы обьявили параметр sy как неизменяемый

а потом в теле функции пытаетесь этому неизменяемуму параметру присвоить значение

в этом и состоит ошибка, парамет если требуеться его изменять нужно обьявлять как изменяемый

проблема вот в таком значке "&" при обьявлении функции.

Well, this is if you need to pass a changed parameter to the outside world in relation to the body of the function. But here, in my opinion, the parameter is simply checked for correctness and, if it happens, its value is changed. There is no crime here.
 
alsu >>:
ну, это если надо передать измененный параметр во внешний мир по отношению к телу функции. А тут по-моему просто параметр проверяется на корректность и в случае чего изменяется его значение. Никакого криминала.

Actually, yes, I'm on autopilot, I've worked out the rules and I don't think twice,

I agree, if the parameter is not transmitted externally, there is no problem.

But keep in mind, if you send "" or "0", it won't change outside the function and it won't become "GBPUSD", for example.

Reason: