Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 81

 
Gevorg Hakobyan:
if(v=="NZD")
{
h=(iClose("NZDUSD",p,b)-iOpen("NZDUSD",p,b))/MarketInfo("NZDUSD",MODE_POINT)+
(iOpen("EURNZD",p,b)-iClose("EURNZD",p,b))/MarketInfo("EURNZD",MODE_POINT)+
(iOpen("GBPNZD",p,b)-iClose("GBPNZD",p,b))/MarketInfo("GBPNZD",MODE_POINT)+
(iOpen("AUDNZD",p,b)-iClose("AUDNZD",p,b))/MarketInfo("AUDNZD",MODE_POINT)+
(iClose("NZDJPY",p,b)-iOpen("NZDJPY",p,b))/MarketInfo("NZDJPY",MODE_POINT)+
(iClose("NZDCAD",p,b)-iOpen("NZDCAD",p,b))/MarketInfo("NZDCAD",MODE_POINT)+
(iClose("NZDCHF",p,b)-iOpen("NZDCHF",p,b))/MarketInfo("NZDCHF",MODE_POINT);
}
It doesn't really matter what you have in your code. Can you tell which DC you are connected to that you get zero instead of Point()?
 
sile:

Hello.

Please help.

Now the lot of each following order is increasing in 1, 2, 3, 4, 5...

I want the lot of each order to increase not each order, but in increments of 3, so 1, 1, 1, 1, 2, 2, 2, 3, 3, 3...

The counter should be started and reset to the initial value when the set threshold is reached:
extern double   LotStop        = 0.01;
extern double   Plus_LotStop   = 0.01;
extern double   Plus_N_ORD  = 3;        //каждые N ордеров
void OnTick()
  {
//---
int c=0;
  for (int i=1; i<=OrdersStop; i++)
   {
       if((Close[1]<Open[1]&&Close[2]>Open[2]&&NumberOfPositions(Symbol(), -1,_Magic)<1))
         {
            OPENORDER (OP_BUYSTOP,PriceBS,LOTs,_Magic,i);
            numB++;
            PriceBS = NormalizeDouble(PriceBS+Step_Stop*Point,Digits);
          
            OPENORDER (OP_SELLSTOP,PriceSS,LOTs,_Magic,i);
            numS++;
            PriceSS = NormalizeDouble(PriceSS-Step_Stop*Point,Digits);
         }
      c++;
      if(c==3){LOTs+=Plus_LotStop;c=0;}
    }
  }
 

Can you tell me if an indicator called "iSignal" works in the terminal, is it possible to find out from an EA that this indicator really exists in any window or in a window with an EA?

 
Vitaly Muzichenko:

Can you tell me if an indicator called "iSignal" works in the terminal, is it possible to find out from an EA that this indicator really exists in any window, or in a window with an EA?

In the Help ChartIndicatorName(); And others you will see there.


ChartIndicatorName

Returns the short name of the indicator by its number in the list of indicators on the specified chart window.

stringChartIndicatorName(
longchart_id,// chart ID
int sub_window,// number of the subwindow
intindex// index of the indicator in the list of indicators added to the given subwindow
);

Parameters

chart_id

[Chart ID. 0 means the current chart.

sub_window

[in] Subwindow number of the chart. 0 means the main chart window.

index

[in] Index of the indicator in the list of indicators. Indicators are numbered starting from zero, i.e. the very first indicator in the list has a zero index. The number of indicators in the list can be obtained by ChartIndicatorsTotal().

Returned Value

Indicator short name, which isdefined in the INDICATOR_SHORTNAME property by IndicatorSetString() function.To get information about the error, call the GetLastError() function.


Go through all of the charts, and look for the required indicator on them. You can also define the number of indicators on the chart, as well as the number of all windows of one chart. You will see there in the help.
 
Vitaly Muzichenko:

Can you tell me if an indicator called "iSignal" works in the terminal, is it possible to find out from an EA that this indicator really exists in any window, or in a window with an EA?

It is possible. Go through the indicators in the loop on the needed chart and compare the name of the selected indicator with the given one. The ChartIndicatorName() function.

Probably, it will have to search also chart subwindows, if the indicator is in the "basement".

 
Artyom Trishkin:

In Help ChartIndicatorName(); And others you will see there too.


ChartIndicatorName

Returns short indicator name by number in the list of indicators on the specified chart window.

stringChartIndicatorName(
longchart_id,// chart ID
intsub_window,// number of subwindow
intindex// index of the indicator in the list of indicators added to this subwindow
);

Thanks, was looking for exactly that, and it works!

And now back) Is it the same, but from an indicator find expert: (c)this expert is really in any window, or a window with indicator?

 
Vitaly Muzichenko:

Thanks, was looking for exactly that, and it works!

And now back) Is there a similar one, only from the indicator to find the expert: (c)is this expert really in any window, or a window with an indicator?

How do you code in general?
WindowExpertName - Операции с графиками - Справочник MQL4
WindowExpertName - Операции с графиками - Справочник MQL4
  • docs.mql4.com
WindowExpertName - Операции с графиками - Справочник MQL4
 
Vitalie Postolache:
How do you code at all?
I know this one, but it doesn't know how to search on other people's graphics.
 
Vitaly Muzichenko:
I know this one, but it cannot search on someone else's chart.

Not only does it not know how to search on someone else's chart, but on its own chart it finds only "its" indicator, script or expert, the one in which this function is prescribed.

I have not checked it, but I have tried going through the loop of charts.

ChartGetString(chart_id, CHART_EXPERT_NAME)
I think it should work.
 
Alexey Viktorov:

Not only does it not know how to search on someone else's chart, but on its own chart it finds only "its" indicator, script or expert, the one in which this function is prescribed.

I have not checked it, but I have tried it on looping through charts

ChartGetString(chart_id, CHART_EXPERT_NAME)
I think it should work.

Yes, it works and it finds from expert indicator by name. But now a question: is there a similar one, but for fours, and preferably crossplatform?

Thank you!

Reason: