[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 254

 

Please re-do the indicator to draw arrows on the same candle where the alert appeared, thank you very much

Files:
stochdivmtf.mq4  16 kb
 
dmmikl86 >> :

help me colour the indicator, I want it to be green if the value goes up, red if it goes down

here's the code:


...and if it doesn't change, it doesn't change colour...

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red


int BarsCount = 10000;

//---- buffers
double buf_1[];
double buf_2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
    SetIndexStyle(0,DRAW_HISTOGRAM);
    SetIndexBuffer(0, buf_1);
    SetIndexStyle(1,DRAW_HISTOGRAM);
    SetIndexBuffer(1, buf_2);
    //----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
int i;
//----
   int limit = BarsCount;
    if ( limit > Bars)
        limit = Bars;
        
   for ( i = limit; 0 <= i; i--) {

        if(High[ i]-Low[ i]>High[ i+1]-Low[ i+1]) buf_1[ i] = High[ i]-Low[ i];
        else 
        if(High[ i]-Low[ i]<High[ i+1]-Low[ i+1]) buf_2[ i] = High[ i]-Low[ i];
        else if( buf_1[ i+1]!=EMPTY_VALUE) buf_1[ i] = High[ i]-Low[ i];
        else if( buf_2[ i+1]!=EMPTY_VALUE) buf_2[ i] = High[ i]-Low[ i];
        
        }
//----
   return(0);
  }
//+------------------------------------------------------------------+

so you don't have to look...

 

Needed a system to correlate with the main trend trading system. I took a stochastic, added ADX and it took me about 10 minutes.

As a result these are the results.



Of course mathematical expectation is very small, but it is in the + and the general movement of the curve is pleasant. Testerester from 1999 to 2009 for 15 min, with an account in 500 (because of this drawdown and this is in %) traded a lot of 0.01, one trade at a time.

Now I think whether I should trust this system or not? I am confused by simplicity and primitiveness, as well as low mathematical expectation and lack of trendiness, but the fact that it is in the + is very pleasing.

The basic system I have thought to use since 2007 trades good, I would even say decent, but it sags quite good on the whole history.

It is a trend following system. ADX-CCI on SAR outputs. Plus we have to add on trend. The result is as follows



This is for 2007-2009 on H4.

And this is for 1999-2009 on H4. I had to increase my account... I was losing everything in the middle of the history(



I'm excited by the good results in more "Modern" market conditions, and for 2009 I've got only positive ones.


My question is: Should I use the main (second) system? Or after looking at the charts I should take the first one and not worry about it? And should we use them together trying to calculate the correlation and use it as a basis for the MM?

 
When I wrote trades since 2007 I meant, of course, history and tests)
 

Why is the test quality n/a when testing on a 1h chart using the smallest 1m timeframe, and the quality field is green.

This is a question.

 
Could you please tell me how to write the values of the indicators in the window to a text file?
 
ddddimon >> :
Can you tell me how to write the values of the indicators that are in the window into a text file?

Like this

int statr
{//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  PRINTS( "Ваш файл", 1000, инд_массив);
return(0);
}//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void PRINTS( string files, int c, double y[])
{//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int han = FileOpen( files+".txt", FILE_WRITE," "); 
if( han>0)
  {FileWrite( han," ");           
   for(int i=0; i< c; i++)
       FileWrite( han, y[ i]);
   FileClose( han);
  }
return;
}//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Pass the indicator array values to the function, or something similar.

 
Urain >> :

Like this.

pass the indicator array values into the function, or something similar.


Thank you!!!

 
Dmido >> :

Needed a system to correlate with the main trend trading system. I took a stochastic, added ADX and it took me about 10 minutes.

As a result these are the results.

Of course mathematical expectation is not very big, but it is in + and the general movement of the curve is pleasant. Testerester from 1999 to 2009 for 15 min, with an account in 500 (because of this drawdown and this is in %) traded a lot of 0.01, one trade at a time.

Now I think whether I should trust this system or not? I am confused by simplicity and primitiveness, as well as low mathematical expectation, and beztrendovost', but the fact that it is in the + is very encouraging.


Question: Should I use the main (second) system? Or after looking at graphs I should take the first one and not worry about it? Or should I use them together trying to calculate the correlation and use it as a base for MM?


For me the chart of the first one looks more promising.

- What are the criteria for closing trades (in profit and loss)?

 

Good afternoon gentlemen, I'm asking for help again with the object elimination script.

The script is removing several objects by name, but on launching it pops up a good hundred errors (or rather, the same one, but many times) help plz.

#include <WinUser32.mqh>

int start() {
int NamesCount = 9;

   for (int x = 0; x < ObjectsTotal(); x++) {
      if (StringFind(ObjectName( x), "1") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
         if (StringFind(ObjectName( x), "2") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
         if (StringFind(ObjectName( x), "3") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
      if (StringFind(ObjectName( x), "4") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
      if (StringFind(ObjectName( x), "5") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
      if (StringFind(ObjectName( x), "6") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
      if (StringFind(ObjectName( x), "7") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
      if (StringFind(ObjectName( x), "8") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
         }
      if (StringFind(ObjectName( x), "9") == 0) {
         ObjectDelete(ObjectName( x));
         x--;
      }
   }
}
Reason: