Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 876

 
Hello all, I have a script that uses calls from an external DLL, which specifically counts quotes and creates a file with the necessary odds, is there any way to make the script run on a schedule? I need it to run every day at a certain hour?
 

Hello,

The picture showed:

First window Volume indicator, put Money Flow Index(10) on top.

I made a separateindicator, where I again take Volume, recalculate the mouwing with Volume and tried to do as in the first window - 25%, 50%, 75%.

I tried it the way I did it, but it did not look good.

If someone has had problems with this, please share your suggestions.

Thanks

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_minimum 0

#property indicator_width1 2
#property indicator_width2 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Yellow

extern int MAPeriod = 30;
double     volum[],ma[];
//+------------------------------------------------------------------+
int init(){
    int bars_count=WindowBarsPerChart(),volh;
    int bar=WindowFirstVisibleBar();
    volh = Volume[iHighest(Symbol(),0,MODE_VOLUME,bar,0)];
    SetIndexBuffer(0,volum);
    SetIndexBuffer(1,ma);
    SetIndexStyle(0,DRAW_HISTOGRAM);
    SetIndexStyle(1,DRAW_LINE);
    SetLevelValue (0,   volh*1.05); 
    SetLevelValue (1, ((volh*1.05)/100)*75.0); 
    SetLevelValue (2, ((volh*1.05)/100)*50.0);
    SetLevelValue (3, ((volh*1.05)/100)*25.0); 
    return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
/*int start(){
    int limit;
        limit = Bars-IndicatorCounted()-1;
    for(int i=limit;i>=0;i--){
        volum[i] = NormalizeDouble(Volume[i],0);
        ma[i]    = NormalizeDouble(iMAOnArray(volum,0,MAPeriod,0,MODE_SMA,i),0);
       }
   return(0);
  }*/
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
    int i=rates_total-prev_calculated-1;
    if(i<0)
       i=0; 
    while(i>=0){
      if(i<rates_total-1)
        volum[i] = NormalizeDouble(Volume[i],0);
        ma[i]    = NormalizeDouble(iMAOnArray(volum,0,MAPeriod,0,MODE_SMA,i),0);
        i--;
       }     
   return(rates_total);
  }
 
tara:
He was talking about the minus second bar. And the average value of the limits. He wants to make fun of me, I guess. I'd tell him to go fuck himself, you know what I mean :)
Second-grader, seventh grader, who still does not know that there is no such country - Belarus, came to the first graders and kochetsya. And in response to any question, he just sends or admonishes them: they should learn. You should read carefully above the door what branch you are in. I am still just learning the alphabet, so don't get too excited, I won't understand anyway.
 

And toevillive and artmedia70 a huge thank you. For your patience and your time. I'm sure it's not just my opinion of you. Everyone who comes to this thread is asking for help and getting it mostly from you. Thank you\

 

Hello, dear Professionals, it's been a long time since I contacted you

The point is, there is an Expert Advisor with 2 muwks crossing and no one bothered with opening an order

void Trade()

{ double ma_fast=ma(Period_,Shift_,Method_MA_,Apply_to_,0), ma_slow=ma(Period__,Shift__,Method_MA__,Apply_to__,0);

if(sumBO==0 && ma_fast>ma_slow && (!Use_Distance || (Use_Distance && ND(ma_fast-ma_slow)>Distance*Pnt))

{

if(sumSO>0 && !ClosePos(OP_SELL)) return;

if(MO(OP_BUY,GetLot(),GetComment())==-1) return;

if(!ModifyByTicket(T)) return;

NumbUp=0; NumbDn=0;

}

else

and so on...

i.e. if there is a crossing of the distance, open an order

I need a code to find the time of the last crossing ...

then from the current moment to the time in the history, search for an order within a certain period... and open an order if it has not found one

i have explored the code of tracer indicators for this purpose, everything seems to be clear there

but I do not know how to time the first bar after the curves crossing so it is the rightmost one

I feel that a forte operator is needed, but I cannot formulate it

 
evillive:

This is not the way to do it. Call iCustom for all 3 buffers, write each value to its own variable and then do what you want with these values.

For the Bollinger strips, for the second bar, according to the example in the help, you don't need to unselect them:

Thank you.

But due to my illiteracy I have to look through my manual all the time and I dug out the following: a custom indicator is a program written in accordance with the author's algorithm. And the tutorial says that iCustomreturns the value of the specified custom indicator.

But I don't use any custom (i.e. as I understand - developed by me) indicators.

I need to retrieve the values of standard, if I can call them so, indicators: Moving Average, Bollinger Bands and Stochastic Oscillator with the parameters I have specified. Of course, I do it "by gut feeling" - the first thing I found will be applied. But your suggested variant does not seem to me suitable as well.

Is there no solution without using all those buffers, arrays and loops? I'm like a boulder in the sea - I sink in it at once.

 
sannin:

Hello, dear Professionals, it's been a long time since I contacted you

The point is, there is an Expert Advisor with 2 muwks crossing and no one bothered with opening an order

void Trade()

{ double ma_fast=ma(Period_,Shift_,Method_MA_,Apply_to_,0), ma_slow=ma(Period__,Shift__,Method_MA__,Apply_to__,0);

if(sumBO==0 && ma_fast>ma_slow && (!Use_Distance || (Use_Distance && ND(ma_fast-ma_slow)>Distance*Pnt))

{

if(sumSO>0 && !ClosePos(OP_SELL)) return;

if(MO(OP_BUY,GetLot(),GetComment())==-1) return;

if(!ModifyByTicket(T)) return;

NumbUp=0; NumbDn=0;

}

else

and so on...

that is, if there is a crossing of the distance, open an order

I need a code to find the time of the last crossing ...

then from the current moment to the time in the history, search for an order within a certain period... and open an order if it has not found one

i have explored the code of tracer indicators for this purpose, everything seems to be clear there

but I do not know how to time the first bar after the curves crossing so it is the rightmost one

I feel that a forte operator is needed, but I cannot formulate it

This Expert Advisor does not work by intersection. The criteria is as follows: if the fast МА is higher than the slow one by X pips and there is no open position, open it at the market.

To find the crossing, one should always take two values - the fast/slow MA before the crossing and the fast/slow MA after the crossing in order to find out when they exchange places, so to speak. In other words

if(FastMA_2<SlowMA_2 && FastMA_1>SlowMA_1) - fast МА has crossed the slow one from bottom to top between the 1st and 2nd bars.

In an infinite loop, look from zero bar to the detection of the crossing, it will be X+1 bar, and you need the time of bar X, that is, the most recent bar after the crossing.

 
rapid_minus:

Thank you.

But, due to my illiteracy, I have to dig through the textbook all the time and this is what I dug out: a custom indicator is a program..., written in accordance with the author's algorithm. And the tutorial says that iCustomreturns the value of the specified custom indicator.

But I don't use any custom (i.e. as I understand - developed by me) indicators.

I need to retrieve the values of standard, if I can call them so, indicators: Moving Average, Bollinger Bands and Stochastic Oscillator with the parameters I have specified. Of course, I do it "by gut feeling" - the first thing I found will be applied. But your suggested variant does not seem to me suitable as well.

Is there no solution without using all those buffers, arrays and loops? I'm like a boulder in the sea in them - I sink at once.

Right, when using Bollinger Bands, you don't need to call iCustom, but iBands should be called separately for each indicator line. The alternative way without calling indicator ("without using buffers, arrays, loops") is to implement in the Expert Advisor the algorithm of calculation of this indicator and read the desired value when needed (you can read only the desired value, for example, only the bottom line). But completely without loops and arrays all the same will not work.
 
sannin:

Hello, dear Professionals, it's been a long time since I contacted you

The point is, there is an Expert Advisor with 2 muwks crossing and no one bothered with opening an order

void Trade()

{ double ma_fast=ma(Period_,Shift_,Method_MA_,Apply_to_,0), ma_slow=ma(Period__,Shift__,Method_MA__,Apply_to__,0);

if(sumBO==0 && ma_fast>ma_slow && (!Use_Distance || (Use_Distance && ND(ma_fast-ma_slow)>Distance*Pnt))

{

if(sumSO>0 && !ClosePos(OP_SELL)) return;

if(MO(OP_BUY,GetLot(),GetComment())==-1) return;

if(!ModifyByTicket(T)) return;

NumbUp=0; NumbDn=0;

}

else

and so on...

i.e., if there is a crossing of the distance, open an order

I need a code to find the time of the last crossing ...

then from the current moment to the time in the history, search for an order within a certain period... and open an order if it has not found one

i have explored the code of tracer indicators for this purpose, everything seems to be clear there

but I do not know how to time the first bar after the curves crossing so it is the rightmost one

I feel that a forte operator is needed, but I cannot formulate it

Here is an example, where I showed how to measure how many bar after crossing 2 muves.
datetime TimeStart = 0;
//+------------------------------------------------------------------+
int init(){return(0);}
int deinit(){return(0);}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   int f;
   bool     cu1     = false;
   bool     cu2     = false;
   double   ma_1    = iMA(NULL,0,31,0,MODE_SMA,PRICE_OPEN,0);
   double   ma1     = iMA(NULL,0,11,0,MODE_SMA,PRICE_OPEN,0);
   double   ma_2    = iMA(NULL,0,31,0,MODE_SMA,PRICE_OPEN,1);
   double   ma2     = iMA(NULL,0,11,0,MODE_SMA,PRICE_OPEN,1);

   if(ma2<ma_2 && ma1>ma_1)
      TimeStart=Time[0]; 
   if(ma2>ma_2 && ma1<ma_1)
      TimeStart=Time[0];
   if(ma1>ma_1)
      cu1=true;
   if(ma1<ma_1)
      cu2=true;

   if(cu1==true || cu2==true)  
      int b1=iBarShift(Symbol(), PERIOD_H1, TimeStart);      
      int b2=iBarShift(Symbol(), PERIOD_H1, TimeCurrent());

    for(int j=b2;j<=b1;j++){
         f=b1-b2;
      }
       
   return(0);
  }
 
evillive:
Right, when using Bollinger Bands, you don't need to call iCustom, you call iBands, for each indicator line - separately. The alternative way without calling indicator ("without using buffers, arrays, and loops") is to implement in the Expert Advisor the algorithm of the indicator calculation and read the right value when needed (you may read only the right value, for example, only the bottom line). But completely without loops and arrays is not possible.

OK. Then how to write this correctly?

MB_2=iBands(NULL,0,10,0,2.0,PRICE_CLOSE,2);
Delta_0=iBands(ExtUpperBuffer[0]-ExtLowerBuffer[0]);

How to extract values of ExtUpperBuffer[0] and ExtUpperBuffer[1], and lower respectively?

Reason: