Download MetaTrader 5
To add comments, please log in or register
Do you wonder how to use widgets? Read the article!
daniel
62
daniel 2014.12.19 20:35 

Hello Guys how are you?

 Well i'm doing fine, but stuck with an idea i have for an indicator i'm creating, there are some rules i developed and right now trading a strategy based out of this manually, but i think my trading would be more effective if i had the indicator i am trying to create, but stuck as i have low training in coding...

 Well what i had was another indicator i created with some help for breacking support and resistance in multitimeframes drawing arrows, it was not a big long extended indicator it ws simple so i took it and started looking how could i make it work into this new idea, so i will need a hand to code for me or make simple changes....

 

 For that i think the code for showing them as simple lines that last 60 min or a sepcified time would be something like:

//+------------------------------------------------------------------+
//|                                                      S&R_GAP.mq4 |
//|                               Copyright © 2014, Daniel Luchinger |
//|                                                                  |
//| You are allowed to copy and distribute this file as you see fit, |
//| and modify it to suit your purposes on the following condition:- |
//|                                                                  |
//| 1. You must charge no money for this indicator or any derivative |
//|    that you create from it.  It was released freely, please keep |
//|    it free.                                                      |
//|                                                                  |
//| 2. If you make alterations, please don't release a new version   |  
//|    using the name "S&R_GAP".  Either release it using a new name,|
//|    or contact me about getting your changes included in my       |
//|    indicator (antonioluchinger@gmail.com).                       |
//|                                                                  |
//| 3. If you make a killer EA based on this indicator, please do me |
//|    a favour and send me a copy :)                                |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+


#property copyright "Copyright © 2014 Daniel Luchinger"
#property link      
#property strict


#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 clrLime
#property indicator_color2 clrRed
#property indicator_color3 clrMagenta
#property indicator_color4 clrCyan
#define BUY  1
#define SELL 2

double Buy[],
       Sell[],
       FirstBuy[],
       FirstSell[];

int OnInit() {

   SetIndexBuffer(2,Buy);
   SetIndexBuffer(3,Sell);
   for(int i=0; i<4; i++) {
      SetIndexStyle (i,DRAW_ARROW,STYLE_SOLID,2);} //how to make it draw a line instead of arrows???
   SetIndexArrow (0,233);
   SetIndexArrow (1,234);
   SetIndexArrow (2,233);
   SetIndexArrow (3,234);
   return(INIT_SUCCEEDED);}




void OnDeinit(const int reason) {}

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[]) {
   
   static int lastSignal=0;
   for(int i=MathMin(rates_total-prev_calculated, rates_total-2); i>=0; i--) {
   Buy[i]=Sell[i]=EMPTY_VALUE;
      
      if((Open[i]-Close[i+1])>0) {
      {
      Buy[i]=Close[i+1]; } //How to draw a line blue color at this price of previous candle close that last only 60min?
      }
      
      if((Open[i]-Close[i+1])<0){
       {
      Sell[i]=Close[i+1]; } //How todraw a line red color at this price of previous candle close that last only 60min?
      }
               
      }



 So this is the first part of the code i need somebody help me make the fixes for 1: instead of drawing an arrow, to draw a line, below current price blue and above current price color red,and that the lines last 60min or the time the user like to use...

 I hope somebody can help, thanks 

/
To add comments, please log in or register