входы лимитками - лимитки меньше проскальзывают, то есть берут цену точнее и вообще это ближе к нормальной торговле. Подчас (на крипте например) и комиссии меньше
а закрытия closeBy экономят 1 спред при закрытии встречных позиций (взаимозачёт происходит)
..
вообще можно закрывать позы единственный раз в день - вечером..небольшой личный клиринг - взаимозакрытия встречных
Здравствуйте! При добавление индикатора на график совершенно рандомным образом начинают пропадать линии или отрисовываться не до конца. В чем может быть проблема? Брал стандартный индикатор аллигатор + сверху на синюю линию наложил две МА Код:
//+------------------------------------------------------------------+//| Alligator.mq5 |//| Copyright 2009, MetaQuotes Software Corp. |//| http://www.mql5.com |//+------------------------------------------------------------------+#property copyright"2009, MetaQuotes Software Corp."#property link"http://www.mql5.com"#property version"1.00"#property indicator_chart_window#property indicator_plots5#property indicator_buffers10#property indicator_type1DRAW_COLOR_LINE#property indicator_color1clrBlue,clrNONE#property indicator_width11#property indicator_label1"Jaws"#property indicator_type2DRAW_COLOR_LINE#property indicator_color2clrRed#property indicator_width21#property indicator_label2"Teeth"#property indicator_type3DRAW_COLOR_LINE#property indicator_color3clrLime#property indicator_width31#property indicator_label3"Lips"#property indicator_type4DRAW_COLOR_LINE#property indicator_color4clrSeaGreen#property indicator_width41#property indicator_label4"BuyLine"#property indicator_type5DRAW_COLOR_LINE#property indicator_color5clrPink#property indicator_width51#property indicator_label5"SellLine"double ExtJaws[];
double ExtColorJaws[];
double ExtTeeth[];
double ExtColorTeeth[];
double ExtLips[];
double ExtColorLips[];
double ExtBuyCr[];
double ExtClrBuyCr[];
double ExtSellCr[];
double ExtClrSellCr[];
//---- input parametersinputint InpJawsPeriod=13; // Jaws periodinputint InpJawsShift=8; // Jaws shiftinputint InpTeethPeriod=8; // Teeth periodinputint InpTeethShift=5; // Teeth shiftinputint InpLipsPeriod=5; // Lips periodinputint InpLipsShift=3; // Lips shiftinputENUM_MA_METHOD InpMAMethod=MODE_SMMA; // Moving average methodinputENUM_APPLIED_PRICE InpAppliedPrice=PRICE_MEDIAN; // Applied price//---- indicator buffers//---- handles for moving averagesint ExtJawsHandle;
int ExtTeethHandle;
int ExtLipsHandle;
int ExtBuyCRHandle;
//--- bars minimum for calculationint ExtBarsMinimum;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
SetIndexBuffer(0,ExtJaws,INDICATOR_DATA);
SetIndexBuffer(1,ExtColorJaws,INDICATOR_COLOR_INDEX);
SetIndexBuffer(2,ExtTeeth,INDICATOR_DATA);
SetIndexBuffer(3,ExtColorTeeth,INDICATOR_COLOR_INDEX);
SetIndexBuffer(4,ExtLips,INDICATOR_DATA);
SetIndexBuffer(5,ExtColorLips,INDICATOR_COLOR_INDEX);
SetIndexBuffer(6,ExtBuyCr,INDICATOR_DATA);
SetIndexBuffer(7,ExtClrBuyCr,INDICATOR_COLOR_INDEX);
SetIndexBuffer(8,ExtSellCr,INDICATOR_DATA);
SetIndexBuffer(9,ExtClrSellCr,INDICATOR_COLOR_INDEX);
//--- indicator buffers mapping//--- set accuracyIndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//---- sets first bar from what index will be drawnPlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpJawsPeriod-1);
PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpTeethPeriod-1);
PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,InpLipsPeriod-1);
PlotIndexSetInteger(3,PLOT_DRAW_BEGIN,InpJawsPeriod-1);
PlotIndexSetInteger(4,PLOT_DRAW_BEGIN,InpJawsPeriod-1);
//---- line shifts when drawingPlotIndexSetInteger(0,PLOT_SHIFT,InpJawsShift);
PlotIndexSetInteger(1,PLOT_SHIFT,InpTeethShift);
PlotIndexSetInteger(2,PLOT_SHIFT,InpLipsShift);
PlotIndexSetInteger(3,PLOT_SHIFT,InpJawsShift);
PlotIndexSetInteger(4,PLOT_SHIFT,InpJawsShift);
//---- name for DataWindowPlotIndexSetString(0,PLOT_LABEL,"Jaws("+string(InpJawsPeriod)+")");
PlotIndexSetString(1,PLOT_LABEL,"Teeth("+string(InpTeethPeriod)+")");
PlotIndexSetString(2,PLOT_LABEL,"Lips("+string(InpLipsPeriod)+")");
PlotIndexSetString(3,PLOT_LABEL,"Buy Line("+string(InpJawsPeriod)+")");
PlotIndexSetString(4,PLOT_LABEL,"Sell Line("+string(InpJawsPeriod)+")");
//--- get MA's handles
ExtJawsHandle=iMA(NULL,0,InpJawsPeriod,0,InpMAMethod,InpAppliedPrice);
ExtTeethHandle=iMA(NULL,0,InpTeethPeriod,0,InpMAMethod,InpAppliedPrice);
ExtLipsHandle=iMA(NULL,0,InpLipsPeriod,0,InpMAMethod,InpAppliedPrice);
ExtBarsMinimum=InpJawsPeriod+InpJawsShift;
if(ExtBarsMinimum<(InpTeethPeriod+InpTeethShift))
ExtBarsMinimum=InpTeethPeriod+InpTeethShift;
if(ExtBarsMinimum<(InpLipsPeriod+InpLipsPeriod))
ExtBarsMinimum=InpLipsPeriod+InpLipsPeriod;
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
//---//--- check for rates totalif(rates_total<ExtBarsMinimum)
return(0); // not enough bars for calculation//--- not all data may be calculatedint calculated=BarsCalculated(ExtJawsHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtJawsHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
calculated=BarsCalculated(ExtTeethHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtTeethHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
calculated=BarsCalculated(ExtLipsHandle);
if(calculated<rates_total)
{
Print("Not all data of ExtLipsHandle is calculated (",calculated,"bars ). Error",GetLastError());
return(0);
}
//--- we can copy not all dataint to_copy;
if(prev_calculated>rates_total || prev_calculated<0) to_copy=rates_total;
else
{
to_copy=rates_total-prev_calculated;
if(prev_calculated>0) to_copy++;
}
//---- get ma buffersif(CopyBuffer(ExtJawsHandle,0,0,to_copy,ExtJaws)<=0)
{
Print("getting ExtJawsHandle is failed! Error",GetLastError());
return(0);
}
if(CopyBuffer(ExtTeethHandle,0,0,to_copy,ExtTeeth)<=0)
{
Print("getting ExtTeethHandle is failed! Error",GetLastError());
return(0);
}
if(CopyBuffer(ExtLipsHandle,0,0,to_copy,ExtLips)<=0)
{
Print("getting ExtLipsHandle is failed! Error",GetLastError());
return(0);
}
//Width +1if(CopyBuffer(ExtJawsHandle,0,0,to_copy,ExtBuyCr)<=0)
{
Print("getting ExtJawsHandle is failed! Error",GetLastError());
return(0);
}
if(CopyBuffer(ExtJawsHandle,0,0,to_copy,ExtSellCr)<=0)
{
Print("getting ExtJawsHandle is failed! Error",GetLastError());
return(0);
}
int limit,bar;
//---- объявления локальных переменных//---if(prev_calculated>rates_total || prev_calculated<=0)// checking for the first start of the indicator calculation
{
limit=rates_total-ExtBarsMinimum; // starting index for calculating all bars
}
else
{
limit=rates_total-prev_calculated; // starting index for calculating new bars
}
for(bar=limit; bar>=0 && !IsStopped();bar--)
{
if(ExtLips[bar+1+4]>ExtJaws[bar+1+4] && ExtTeeth[bar]<ExtJaws[bar]){
ExtColorJaws[bar]=1.0;
ExtClrBuyCr[bar]=1.0;
}
elseif(ExtLips[bar+1+4]<ExtJaws[bar+1+4] && ExtTeeth[bar]>ExtJaws[bar]){
ExtColorJaws[bar]=1.0;
ExtClrSellCr[bar]=1.0;
}
else {ExtColorJaws[bar]=0.0;
ExtClrSellCr[bar]=0.0;
ExtClrBuyCr[bar]=0.0;}
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+
W1nd ReD #: Здравствуйте! При добавление индикатора на график совершенно рандомным образом начинают пропадать линии или отрисовываться не до конца. В чем может быть проблема? Брал стандартный индикатор аллигатор + сверху на синюю линию наложил две МА Код: проблема во вложениях
Посмотрите что в буферах на тех участках, где, по по вашему, мнению должна быть отрисовка. Обычно, посмотреть можно через окно данных.
Возможно, это даст понимание к направлению поиска проблемы.
При частичном закрытии можно комментарий задавать?
ты можешь частично закрывать встречкой
То есть открываешь встречную позицию меньшим объёмом с нужным коментом и об неё частично закрываешь через closeBy
(к слову - при наличии возможности, лучше вообще все входы лимитками а все закрытия closeBy)
ты можешь частично закрывать встречкой
То есть открываешь встречную позицию меньшим объёмом с нужным коментом и об неё частично закрываешь через closeBy
(к слову - при наличии возможности, лучше вообще все входы лимитками а все закрытия closeBy)
Спасиб. А чем closeBy лучше?
Спасиб. А чем closeBy лучше?
входы лимитками - лимитки меньше проскальзывают, то есть берут цену точнее и вообще это ближе к нормальной торговле. Подчас (на крипте например) и комиссии меньше
а закрытия closeBy экономят 1 спред при закрытии встречных позиций (взаимозачёт происходит)
..
вообще можно закрывать позы единственный раз в день - вечером..небольшой личный клиринг - взаимозакрытия встречных
нужны фигурные скобки
Скобки я поменял, а ошибка " 'aaa_1111' - some operator expected ", осталась.
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
Tretyakov Rostyslav, 2025.03.27 14:04
Измените также имя переменной, только цифры не пропускает
Код: проблема во вложениях
Здравствуйте! При добавление индикатора на график совершенно рандомным образом начинают пропадать линии или отрисовываться не до конца. В чем может быть проблема? Брал стандартный индикатор аллигатор + сверху на синюю линию наложил две МА
Код: проблема во вложениях
Посмотрите что в буферах на тех участках, где, по по вашему, мнению должна быть отрисовка. Обычно, посмотреть можно через окно данных.
Возможно, это даст понимание к направлению поиска проблемы.
а закрытия closeBy экономят 1 спред при закрытии встречных позиций (взаимозачёт происходит)
Так это понятно. Я думал срабатывает как-то лучше.
Посмотрите что в буферах на тех участках, где, по по вашему, мнению должна быть отрисовка. Обычно, посмотреть можно через окно данных.
Возможно, это даст понимание к направлению поиска проблемы.
Данные в окне данных есть, но отрисовки красной и зеленой линии - иногда пропадают(А данные не пропали)