[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 274

 
ANG3110:


On hourly charts and below, you can draw hourly timeframe bars and without taking prices from another timeframe. Linking with iHigh, etc. is not very useful as it slows down the indicator and needs to bump the other timeframe.

If it is possible to do everything on one timeframe, this is preferable.

And how do you practically draw hourly data on a smaller timeframe? Well, it's roughly like this:


THANK YOU for the tip):
 
Andrew1001:

There you go! How do you put the code out there so that you can look at it, to refine it?
Ask for the source code from the EA's author and post it with his permission.
 
nlp2311:

THANK YOU for the tip):

It doesn't look as pretty as candles. But you can do it with candlesticks, but it's a hassle to do and it's practically impractical.

The trading week starts for me and I'm sorry, I will not write and reply on the forum anymore. I'm sorry, I will not write and answer on the forum any more.

Although it takes a lot of experience to easily write programmatically what you think. Usually 1-3 years.

 
Dimka-novitsek:

Hi, could you please tell me how to write it correctly?

The thing is, ObjectSetText doesn't seem to do anything, so I get text instead of vertex caption.


What in GetLastError()?
 
Ofc ukzye! I'll have a look!!!
 
Four thousand two hundred. Yes, I finally made it! There you go
 ObjectCreate( "вершина",  OBJ_TEXT , WindowOnDropped( ) , Time[бар_вершина],  вершина+(10*Point)) ; 
    ObjectSetText( "вершина", "вершина", 5, "вершина",Crimson ) ; Alert("GetLastError()",GetLastError());
      // ObjectSet(  "вершина",  OBJPROP_COLOR, Crimson) ;
 
You know, I can't get the indicator right. Right now it's not drawing. Sometimes it does, sometimes it doesn't, and now it doesn't. And there's no pattern. I've added graphic objects to it. And he's not drawing!
//+------------------------------------------------------------------+
//|                                            ИндюкДимонакомпил.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#import "user32.dll"
   int   PostMessageA(int  hWnd,int  Msg,int  wParam,string lParam);
#import
#define WM_COMMAND                     0x0111
int delimiter = 0;

#property indicator_chart_window

#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 DarkBlue
double ВерхняячертаBuffer1[];
double НижняячертаBuffer2[];
double СинняячертаBuffer3[];
 double вершина; 
 double основание_первого_снижения;
 double начало;
 double вершина_волны_3;
 extern int T=4,K=200;
 int timeframe, start ;
 int бар_вершина ;
 int бар_основание_первого_снижения;
 int бар_начало;
int pereklutsatel;
double naklon,linija2; int P;extern int RO=-1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

SetIndexStyle(0,DRAW_SECTION,STYLE_SOLID,2,CLR_NONE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(0,ВерхняячертаBuffer1);//Alert ("SetIndexBuffer ",GetLastError( ) );
   SetIndexEmptyValue(0,0.0);
   
   SetIndexStyle(1,DRAW_SECTION,STYLE_SOLID,2,CLR_NONE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(1,НижняячертаBuffer2);//Alert ("SetIndexBuffer ",GetLastError( ) ); 
   SetIndexEmptyValue(1,0.0);
   
   SetIndexStyle(2,DRAW_SECTION,STYLE_SOLID,T,CLR_NONE);//Alert ("SetIndexStyle ",GetLastError( ) );
  SetIndexBuffer(2,СинняячертаBuffer3);//Alert ("SetIndexBuffer ",GetLastError( ) ); 
   SetIndexEmptyValue(2,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("вершина");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit=Bars-counted_bars-1;

   for (int i=limit;i>=0;i--) {
//----
 for ( int J=0;J<=RO;J++){
//----

  // for(int i=Bars; i>=0;i--)
   i=Bars;
      бар_вершина=iHighest( NULL,  timeframe, MODE_HIGH, K, start ) ;
       вершина =High[ бар_вершина ];
       бар_основание_первого_снижения=iLowest( NULL,  timeframe, MODE_LOW,NormalizeDouble ( бар_вершина/2,0), start ) ;
       основание_первого_снижения=Low[ бар_основание_первого_снижения ];
       бар_начало=iLowest( NULL,  timeframe, MODE_LOW,NormalizeDouble (бар_вершина*1.5,0), бар_вершина ) ;
       начало=Low[ бар_начало ];
       
   ObjectCreate( "вершина",  OBJ_TEXT , WindowOnDropped( ) , Time[бар_вершина],  вершина+(10*Point)) ; 
    ObjectSetText( "вершина", "вершина", 5, "вершина",Crimson ) ; Alert("GetLastError()",GetLastError());
      // ObjectSet(  "вершина",  OBJPROP_COLOR, Crimson) ;
      
   ObjectCreate( "основание_первого_снижения",  OBJ_TEXT , WindowOnDropped( ) , Time[бар_основание_первого_снижения],  основание_первого_снижения-(10*Point)) ; 
    ObjectSetText( "основание_первого_снижения", "основание_первого_снижения", 5, "основание_первого_снижения",Crimson ) ;   
   
    ObjectCreate( "начало",  OBJ_TEXT , WindowOnDropped( ) , Time[бар_начало],  начало-(10*Point)) ; 
    ObjectSetText( "начало", "начало", 5, "начало",Crimson ) ;   
           
  if(начало>основание_первого_снижения){naklon=(начало-основание_первого_снижения)/(бар_начало-бар_основание_первого_снижения);
  Alert("naklon  ", naklon);
    НижняячертаBuffer2[бар_начало]=начало;linija2=начало;for(i=бар_начало-1;i>=0;i--){linija2=linija2-naklon;
   
    НижняячертаBuffer2[i]=linija2;   Alert ("linija2  " , linija2 );  Alert("НижняячертаBuffer2[i]  ", НижняячертаBuffer2[i] , "  i " , i);
     
   }
    НижняячертаBuffer2[бар_основание_первого_снижения]=основание_первого_снижения;}
    
    
         for (i=0;i<100;i++){  СинняячертаBuffer3[i]= Open[i];}
          for (i=330;i<500;i++){  СинняячертаBuffer3[i]= Open[i];}

     ВерхняячертаBuffer1[бар_начало]=начало;
     
 double точка4; int бар_точка4;   бар_точка4=iHighest( NULL,  timeframe, MODE_HIGH, бар_основание_первого_снижения, 3 ) ; 
  точка4 =High[ бар_точка4 ];  
   
   if(вершина>точка4){naklon=(начало-точка4)/(бар_начало-бар_точка4);
   ObjectCreate( "точка4",  OBJ_TEXT , WindowOnDropped( ) , Time[бар_точка4],  точка4+(10*Point)) ; 
    ObjectSetText( "точка4", "точка4", 5, "точка4",Crimson ) ;  
   double linija1=начало;for(i=бар_начало-1;i>=0;i--){linija1=linija1-naklon;ВерхняячертаBuffer1[i]=linija1; }}
   
double vulf=НижняячертаBuffer2[0];
  if ( vulf==Ask&&vulf==Bid)vulf=1;
  else{ for (vulf=vulf+Point*10; vulf==НижняячертаBuffer2[0];vulf=vulf-Point){
           if ( vulf==Ask&&vulf==Bid){vulf=1;}} 
      for (vulf=vulf-Point*10; vulf==НижняячертаBuffer2[0];vulf=vulf+Point){
           if ( vulf==Ask&&vulf==Bid)vulf=1;} 
              
           
           
           }
           
           
   if (vulf==1){Comment ("  Есть вульв!!! "  , "  timeframe " , timeframe);return(0);  }
    if (vulf!=1&&pereklutsatel==1) {    
   
     if(delimiter<3){delimiter++;Comment(delimiter);return(0);}
   delimiter=0;
    fChangePeriod();P++;
                                 
                   }  } }
//----
   return(0);
  }
//+------------------------------------------------------------------+

void fChangePeriod(){int ii,hwd = WindowHandle(Symbol(),Period());
   switch(Period()){
      case PERIOD_W1    : ii = 33134; break; //PERIOD_D1;
      case PERIOD_D1    : ii = 33136; break; //PERIOD_H4;
      case PERIOD_H4    : ii = 33135; break; //PERIOD_H1;
      case PERIOD_H1    : ii = 33140; break; //PERIOD_M30;
      case PERIOD_M30   : ii = 33139; break; //PERIOD_M15;
      case PERIOD_M15   : ii = 33138; break; //PERIOD_M5;
      case PERIOD_M5    : ii = 33137; break; //PERIOD_M1;
      case PERIOD_M1    : ii = 33141; break; //PERIOD_W1;
   }     
   PostMessageA(hwd, WM_COMMAND, ii, 0);
   return;
}
 
There's a lot of code, I'm wildly sorry, but there must be some basic reason!
 

Hi !!!!

Can you tell me how to change the start date - so that it starts not from the date given in text form, but from a date smaller than the current date by a given number of days?

I.e. set shift backwards (e.g. 3 days), and it counts from 00=00h of that day.


extern datetime TimeStart = D'2012.07.01 00:00'; //Time of analysis start

 
I'm sick of shifting manually every day on every chart ... )