[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 330

 

if it is an expert, then loop it and refresh it more often, if it is an indicator, then it is the indicator, not the start function.

 
Roman. >> :


I am already familiarising myself with... Day(), Hour() etc. ....


How are the numbers and Datetime variables compared: e.g. waiting time of 5 bars and the difference between text time and

>> time to open a position? How do I even set the waiting time of 5 bars in Datetime format for later comparison?

 
Roman. писал(а) >>

How are the numbers and Datetime variables compared: e.g. waiting time of 5 bars and the difference between text time and

The difference between the actual time and the open time? How do I set the wait time of 5 bars in Datetime format for the subsequent comparison?

ibarshift

 

I apologise in advance if I am asking a silly question, but I would like to clarify my situation.


I have a problem with SSB4 (Stock Strategies Builder 4). After the program selects the strategy, connects to the repository, runs the strategies downloaded from there, the following happens:
SSB displays a strategy chart (where the Save and Cancel buttons are). If Cancel is pressed, the programme does not open MT4, does not try the next strategy and does not show the chart of the next strategy, but returns to the initial window. Nothing happens further. If I press Save, the strategy is saved, but then again the initial window and no action. I tried SSB3 - everything is normal there. Perhaps the whole thing is that SSB4 is not downloaded from Reshetov Yu site, and from another resource. If that is the case, could you please share the working version of SSB4.

Thank you in advance.


P.S. I wrote about it in the appropriate thread but the last post there was from 31st August so I decided to ask for help here.

 
vasya_vasya >> :

if it is an expert, then loop it and refresh it more often, if it is an indicator, it is the indicator that is the problem, not the start function.


it's a ticks counter. I use it to collect my own volumes, but sometimes (not always) they are less than native Volumes[] of the terminal. They say a new tick comes while the previous one is being processed, that's why the new one is not fixed.
 
Chemist писал(а) >>

is ticks counter. I collect my own volumes with it, but sometimes (not always) they are less than native Volumes[] of the terminal. They say a new tick comes while the previous one is being processed, that's why the new one is not fixed.

>> show the code.

 
vasya_vasya >> :

>> show the code.

#property indicator_separate_window
#property indicator_buffers  1
#property indicator_color1   SlateGray
#property indicator_width1   2
double Vols[];

int init()
  {
   SetIndexBuffer(0, Vols);
   SetIndexStyle(0,DRAW_HISTOGRAM);
   return(0);
  }
int deinit()
  {
   return(0);
  }

int V;
datetime New_Time;

int start()
  {    
    if( New_Time != Time[0])
      {
        New_Time = Time[0];
        V = 1;
        Vols[0] = V;
        return;   
      }
    else if( New_Time == Time[0])
      {
        V++;
        Vols[0] = V;
        return;        
      }
    return(0);
  }


Don't be too harsh.)

 

Folks, good afternoon.

I came across a Trend Detector on one of the forums. The author claimed it shows the trend very well and can help me in creating an oscillator system. But he implemented it directly in his Expert Advisor. I tried to make an indicator based on it. I want to see if it calculates correctly.

I quote the author:

-----------------------------------------------

I have not expected such a good result from this finding of mine. I accidentally made it - put it there. And even jumped in surprise!
I insert this piece in almost any Expert Advisor and even a losing EA makes some profit!
You just need to add it to the condition to buy
if ((Delta>=0) && ... ...
And in the condition for selling -
if ((Delta<=0) && ... ...
However, note that this code does not increase the profit itself. It decreases the number of deals against the trend (mainly losing ones) and
greatly increases the Expert Advisor's PROFIT parameter - to at least two! Which means, outside of the optimization period
we are much more likely to make a profit!
You can also take out the external parameters - DELTA and optimize it for long
And root positions in the range from "-0.05" to "+0.05"
The idea is this:
Take indicators BearsPower and BullsPower (strength of bulls and strength of bears) and compare them with each other.
But just compare them in this way - it's futile.... It is difficult to do it programmatically. That's why I put MAs on them and compare exactly MA readings on zero bar! We simply add up these values and set the sum = Delta. Further everything is simple. If DELTA.>0 - the trend is up. Otherwise it is going downwards!


 
Stepan241 писал(а) >>

Folks, good afternoon.

I came across a Trend Detector on one of the forums.

Like, are you going to sell?

 

I am trying to write an indicator. The idea is simple: we're going to average (strength of bulls - strength of bears). Naturally, for a certain period of time.

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red

double Buf_0[1000],Buf_1[1000],Bears_array[1000],Bulls_array[1000],MA_Bears[1000],MA_Bulls[1000]; // array declaration (for indicator buffers)

int init()
{
SetIndexBuffer(0,Buf_0);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
return;
}
extern PeriodPower=5;
extern MA_Period=5;

int start()
{
int i=Bars-IndicatorCounted()-1;
while(i>=0)
{
Bears_array[i]=iBearsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
Bulls_array[i]=iBullsPower(NULL,0,PeriodPower,PRICE_CLOSE,i);
MA_Bears[i]=iMAOnArray(Bears_array,0,MA_Period,0,MODE_EMA,i);
MA_Bulls[i]=iMAOnArray(Bulls_array,100,MA_Period,0,MODE_SMA,i);
Buf_0[i]=MA_Bulls[i];
i--;
}
return;
}

I display only smoothed bulls Buf_0[i]=MA_Bears[i]; it is done to control at a certain stage of index plotting. Not even EXACTLY. If I smooth them with a period of 1, they in fact must repeat embedded bulls. Hence, I concluded that something is wrong in the line MA_Bulls[i]=iMAOnArray(Bulls_array,100,MA_Period,0,MODE_SMA,i); I don't understand what exactly...HELP me!!!! It's been 3 days of looking through manuals and documentation. THANK YOU!

Reason: