i got it - when positions get to profit - by pressing the button, more positions will open in the direction of
No, it turns out that when the horizontal line worked for the sell, the buy button works for the sell button and the sell button does not work ----- probably the reversal button should be used.
I will have to experiment to see what is best, but a reversal would probably help.
When opening a position, stop loss is set immediately - but so is the trawl (it's a yellow horizontal line), to disable it, just set 0
inputstring t2="------ Obj:Trailing Line --- "; // Trailing Obj:Lineinputdouble InpStopLoss = 55; // Obj: Stop Loss, in pips (1.00045-1.00055=1 pips) ------------------что бы отключить, ставим 0 !!!!!!inputushort InpObjTrailingStop = 27; // Obj: Trailing Stop (distance from price to object, in pips)inputushort InpObjTrailingStep = 9; // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
but the stop loss will not be at the same position, it will be pulled up by the trailinginputushort InpObjTrailingStop = 27;// Obj: Trailing Stop (distance from price to object, in pips)
При создании графического объекта функцией ObjectCreate() необходимо указать тип создаваемого объекта, который может принимать одно из значений перечисления ENUM_OBJECT. Дальнейшие уточнения свойств созданного объекта возможно с помощью функций по работе с графическими объектами.
I messed up here - it works on demo, but on real it got error 2019.11.05 15:51:33.103 AVGiS intelligence (GBPUSD,H1) array out of range in 'AVGiS intelligence.mq5' (176,34)
//+------------------------------------------------------------------+//| Calculate optimal lot size |//+------------------------------------------------------------------+double TradeSizeOptimized(void)
{
double price=0.0;
double margin=0.0;
string arr[];
int resize = 0, syTotal = SymbolsTotal(true);
for(int i = 0; i < syTotal; i++)
{
string name = SymbolName(i, true);
if(SymbolInfoInteger(name, SYMBOL_VISIBLE))
{
resize = ArrayResize(arr, i+1);
arr[i] = name;
}
//--- select lot sizeif(!SymbolInfoDouble(arr[i],SYMBOL_ASK,price))
return(0.0);
if(!OrderCalcMargin(ORDER_TYPE_BUY,arr[i],1.0,price,margin))
return(0.0);
if(margin<=0.0)
return(0.0);
}
double lot=NormalizeDouble(AccountInfoDouble(ACCOUNT_MARGIN_FREE)*MaximumRisk/margin,2);
//--- calculate number of losses orders without a breakif(DecreaseFactor>0)
{
//--- select history for accessHistorySelect(0,TimeCurrent());
//---int orders=HistoryDealsTotal(); // total history dealsint losses=0; // number of losses orders without a breakfor(int y=orders-1; y>=0; y--)
{
ulong ticket=HistoryDealGetTicket(y);
if(ticket==0)
{
Print("HistoryDealGetTicket failed, no trade history");
break;
}
for(int i = 0; i < syTotal; i++)
{
string name = SymbolName(i, true);
if(SymbolInfoInteger(name, SYMBOL_VISIBLE))
{
resize = ArrayResize(arr, i+1);
arr[i] = name;
}
//--- check symbolif(HistoryDealGetString(ticket,DEAL_SYMBOL)!=arr[i])
continue;
//--- check Expert Magic numberif(HistoryDealGetInteger(ticket,DEAL_MAGIC)!=Magic_Number)
continue;
//--- check profitdouble profit=HistoryDealGetDouble(ticket,DEAL_PROFIT);
if(profit>0.0)
break;
if(profit<0.0)
losses++;
}
}
//---if(losses>1)
lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
}
for(int i = 0; i < syTotal; i++)
{
string name = SymbolName(i, true);
if(SymbolInfoInteger(name, SYMBOL_VISIBLE))
{
resize = ArrayResize(arr, i+1);
arr[i] = name;
}
//--- normalize and check limitsdouble stepvol=SymbolInfoDouble(arr[i],SYMBOL_VOLUME_STEP);
lot=stepvol*NormalizeDouble(lot/stepvol,0);
double minvol=SymbolInfoDouble(arr[i],SYMBOL_VOLUME_MIN);
if(lot<minvol)
lot=minvol;
double maxvol=SymbolInfoDouble(arr[i],SYMBOL_VOLUME_MAX);
if(lot>maxvol)
lot=maxvol;
}
//--- return trading volumereturn(lot);
}
//+------------------------------------------------------------------+
2nd possibility: line 7 will open a line 10 at a given distance which moves behind the price and when the price touches it, a command will trigger. line 8 will open a line 9 at a given distance, - the same action as for 7 and 10
При создании графического объекта функцией ObjectCreate() необходимо указать тип создаваемого объекта, который может принимать одно из значений перечисления ENUM_OBJECT. Дальнейшие уточнения свойств созданного объекта возможно с помощью функций по работе с графическими объектами.
1 possibility : line 1 will open line 4 at a given distance, line 2 will open line 3 at a given distance.
2 possibilities: line 7 will open a line 10 at a given distance which moves behind the price and when the price touches it, a command will trigger. line 8 will open a line 9 at a given distance, - the same action as for 7 and 10.
tried how it works
you could have changed in the settings from that line - would have opened a sell
1 possibility : line 1 will open line 4 at a given distance, line 2 will open line 3 at a given distance.
2nd possibility: line 7 will open a line 10 at a given distance, which moves behind the price and when the price touches it, a command will trigger. line 8 will open a line 9 at a given distance, - the same action as for 7 and 10.
in the first possibility, lines 4 and 3 will open at a given distance, up to infinity
#property version "1.07"
Changed the colour of the buttons.
I don't use buttons - just as an information panel
#property version "1.07"
Changed the colour of the buttons.
buttons are not used - just as an information bar
and another colour
tell me who author of this code -(or originally I downloaded another code from the link you gave meSpeed-v1.mq548 kb)
because it's like this
is it him?
i got it - when positions get to profit - by pressing the button, more positions will open in the direction of
No, it turns out that when the horizontal line worked for the sell, the buy button works for the sell button and the sell button does not work ----- probably the reversal button should be used.
I will have to experiment to see what is best, but a reversal would probably help.
#property version "1.08"
added a reversal button.
and in the settings, changed the location
button setup
When opening a position, stop loss is set immediately - but so is the trawl (it's a yellow horizontal line), to disable it, just set 0
but the stop loss will not be at the same position, it will be pulled up by the trailinginput ushort InpObjTrailingStop = 27;// Obj: Trailing Stop (distance from price to object, in pips)
----------------------------------------------------------------
I don't understand how these buttons work.
#property version "1.09"
Added another button - deletes all open positions for all pairs.
Deletes Expert Advisor and changes chart template
#property version "1.10"
added, hide buttons.
I messed up here - it works on demo, but on real it got error 2019.11.05 15:51:33.103 AVGiS intelligence (GBPUSD,H1) array out of range in 'AVGiS intelligence.mq5' (176,34)
here's a working expert
Added to the previous Expert, two methods for the Horizontal line.
1 possibility : line 1 will open line 4 at a given distance, line 2 will open line 3at a given distance.
2nd possibility: line 7 will open a line 10 at a given distance which moves behind the price and when the price touches it, a command will trigger. line 8 will open a line 9 at a given distance, - the same action as for 7 and 10
Added to the previous Expert, two methods for the Horizontal line.
1 possibility : line 1 will open line 4 at a given distance, line 2 will open line 3 at a given distance.
2 possibilities: line 7 will open a line 10 at a given distance which moves behind the price and when the price touches it, a command will trigger. line 8 will open a line 9 at a given distance, - the same action as for 7 and 10.
tried how it works
you could have changed in the settings from that line - would have opened a sell
Added to the previous Expert, two methods for the Horizontal line.
1 possibility : line 1 will open line 4 at a given distance, line 2 will open line 3 at a given distance.
2nd possibility: line 7 will open a line 10 at a given distance, which moves behind the price and when the price touches it, a command will trigger. line 8 will open a line 9 at a given distance, - the same action as for 7 and 10.
in the first possibility, lines 4 and 3 will open at a given distance, up to infinity