-The number of multiplications can be adjusted with function OrdersClose, and when it reaches a specified value, lot will be reset to the starting one;
- the lot volume should not be reset to the starting volume, but must be decreased sequentially in reverse order;
for example OrdersClose=5, Martin=2, lot=0.01:
we have the sequence: 0.01; 0.02; 0.04; 0.08; 0.16 (reset) 0.01; 0.01;,,,,
-The number of multiplications can be adjusted with function OrdersClose, and when it reaches a specified value, lot will be reset to the starting one;
- the lot volume should not be reset to the starting volume, but must be decreased sequentially in reverse order;
for example OrdersClose=5, Martin=2, lot=0.01:
we have the sequence: 0.01; 0.02; 0.04; 0.08; 0.16 (reset) 0.01; 0.01;,,,,
I don't have enough knowledge to solve the problem myself.
I have tried entering different combinations, but have not achieved the desired effect.
//+------------------------------------------------------------------+//| Расчет лота |//+------------------------------------------------------------------+double Lots()
{
double L=0;
// если последняя закрытая сделка убыточная и лот равен стартовому// включаем Мартинif(GetInfoLastPos(2)<0&&GetInfoLastPos(1)==Lot)
{
Martin=true;
}
// если последняя закрытая сделка убыточная и лот больше или равен максимальному// выключаем Мартинif(GetInfoLastPos(2)<0&&GetInfoLastPos(1)>=MaxMartinLot)
{
Martin=false;
}
// если последняя закрытая сделка убыточная и Мартин включен, умножаем лотif(Martin==true)
{
L=NormalizeDouble(GetInfoLastPos(1)*K_Martin,DigitsLot);
}
// если последняя закрытая сделка убыточная и Мартин выключен, делим лотif(Martin==false)
{
L=NormalizeDouble(GetInfoLastPos(1)/K_Martin,DigitsLot);
}
if(L>MAXLOT) L = MAXLOT;
if(L<MINLOT) L = MINLOT;
return(L);
}
//+----------------------------------------------------------------------------+//| Функция возвращает по символу и магику |//| 1 - размер лота последней закрытой позиции |//| 2 - размер профита с учетом комиссии и свопа последней закрытой позиции |//| 3 - время последней закрытой позиции |//+----------------------------------------------------------------------------+double GetInfoLastPos(int a=1)
{
datetime t=0;
double result=0,l=0,p=0,f=0;
int i=OrdersHistoryTotal();
for(int pos=0; pos<i; pos++)
{
if(OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY))
{
if(OrderSymbol()==_Symbol && OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
{
if(t<OrderCloseTime()) {t=OrderCloseTime(); l=OrderLots(); p=OrderProfit()+OrderCommission()+OrderSwap();}
}
}
}
}
if(a==1) {result=l;} elseif(a==2) {result=p;} elseif(a==3) {result=(double)t;}
else {result=0;}
return(result);
}
module difference. Without module, only top zone falls into the condition. | OpenPrice - Bid |> 10*_Point opening condition
This is how the condition should be, Bid is lower than OpenPrice and no modules.
Otherwise we will get correct result if Bid is higher than OpenPrice
module difference. Without the module only the top zone falls into the condition. | OpenPrice - Bid |> 10*_Point opening condition
I don't quite get it...
Can you please make it clearer...for a beginner)
You surprise me.
How?
From the picture you can see that OpenPrice - Bid should not be more than 10*_Point
but can be less, including negative
but can be less, including negative
Yeah... and you get the condition with "&& > 0"
What's the question? Just like that, or for something?
Yeah... and you get the condition with "&& > 0"
What's the question? Just like that, or for something?
I'm currently using this definition of the moment to enter the market
I thought there might be a way to simplify it)
Help optimise a piece of code for martin
The task is this:
-after the stop, a Martin will multiply the lot;
-The number of multiplications can be adjusted with function OrdersClose, and when it reaches a specified value, lot will be reset to the starting one;
- the lot volume should not be reset to the starting volume, but must be decreased sequentially in reverse order;
for example OrdersClose=5, Martin=2, lot=0.01:
we have the sequence: 0.01; 0.02; 0.04; 0.08; 0.16 (reset) 0.01; 0.01;,,,,
need: 0.01; 0.02; 0.04; 0.08; 0.16 (reset) 0.16; 0.08; 0.04; .... 0,01.
I don't have enough knowledge to solve the problem myself.
I have tried different combinations, but have not achieved the desired effect.
I am currently using this definition of market entry point
I thought there might be a way to simplify it)
And Alexey has it right))
This is how it should be by condition, Bid below OpenPrice and no modules.
Otherwise we get correct result if Bid is higher than OpenPrice
Fixed)
Yes, correct. Did not change the condition. Out of habit. It confuses in the picture that Bid is in the middle))))
But there second condition, entry is the same in number of conditions.
Help optimise a piece of code for martin
The task is this:
-after the stop, a Martin will multiply the lot;
-The number of multiplications can be adjusted with function OrdersClose, and when it reaches a specified value, lot will be reset to the starting one;
- the lot volume should not be reset to the starting volume, but must be decreased sequentially in reverse order;
for example OrdersClose=5, Martin=2, lot=0.01:
we have the sequence: 0.01; 0.02; 0.04; 0.08; 0.16 (reset) 0.01; 0.01;,,,,
need: 0.01; 0.02; 0.04; 0.08; 0.16 (reset) 0.16; 0.08; 0.04; .... 0,01.
I don't have enough knowledge to solve the problem myself.
I have tried entering different combinations, but have not achieved the desired effect.
And Alexei has it right))
Yes, that's right. Didn't change the condition. Out of habit. It's confusing in the picture that Bid is in the middle)))
Thanks, but it doesn't simplify my code in any way)