• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:40pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:40pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Need an HMA indicator that is included with SMA, EMA, ... 2 replies

Daily LinesBoxes indicator - fix for old code 5 replies

Whats the Best Trend indicator? 24 replies

Not sure whats wrong with code 2 replies

whats wrong with this piece of code? 14 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: Indicator fix...code included.. WHATS WRONG?!?
Exit Attachments
Tags: Indicator fix...code included.. WHATS WRONG?!?
Cancel

Indicator fix...code included.. WHATS WRONG?!?

  • Post #1
  • Quote
  • First Post: Jan 14, 2009 10:11pm Jan 14, 2009 10:11pm
  •  nebuman213
  • | Joined Jan 2009 | Status: Member | 305 Posts
I want my indicator to draw 3 lines.

1) Daily Open
2) (Daily Open) - 30 pips
3) (Daily Open) + 30 pips

I modified an indicator plotting 3 lines to do this for me, but it only works in the Daily chart...it starts plotting the Open for the current bar in other time frames which is not what I need...I posted the code below, please take a look and see what I did wrong! THANKS!

//+------------------------------------------------------------------+
//| MTC.mq4 |
//| Copyright 2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"


/*
Constant Value Description
DRAW_LINE 0 Drawing line.
DRAW_SECTION 1 Drawing sections.
DRAW_HISTOGRAM 2 Drawing histogram.
DRAW_ARROW 3 Drawing arrows (symbols).
DRAW_ZIGZAG 4 Drawing sections between even and odd indicator buffers.
DRAW_NONE 12 No drawing.

Drawing style. Valid when width=1. It can be any of the following values:

Constant Value Description
STYLE_SOLID 0 The pen is solid.
STYLE_DASH 1 The pen is dashed.
STYLE_DOT 2 The pen is dotted.
STYLE_DASHDOT 3 The pen has alternating dashes and dots.
STYLE_DASHDOTDOT 4 The pen has alternating dashes and double dots.

*/

#property indicator_chart_window

#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Blue
#property indicator_color3 White
#property indicator_color4 Red
#property indicator_color5 Red
//---- input parameters

extern int myWingDingL = 250 ;
extern int myWingDingO = 250 ;
extern int myWingDingS = 250 ;

extern int myLine = DRAW_LINE ;
extern int myStyle = STYLE_SOLID ;

extern string session_name = "Day open";

extern int straddle_width=30;
extern int channel=0;

double lgb[];
double opn[];
double shb[];
double open_price;
double rates_d1[2][6];
string OP, BZ, BZW, SZ, SZW;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

SetIndexBuffer(1, lgb);
SetIndexBuffer(2, opn);
SetIndexBuffer(4, shb);


//---- indicators

SetIndexStyle(1,myLine, myStyle);
SetIndexArrow(1,myWingDingL);
SetIndexBuffer(1,lgb);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,myLine, myStyle);
SetIndexArrow(2,myWingDingO);
SetIndexBuffer(2,opn);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(4,myLine, myStyle);
SetIndexArrow(4,myWingDingS);
SetIndexBuffer(4,shb);
SetIndexEmptyValue(4,0.0);

//----
//---- indicators


OP = "Open " + session_name;
BZ = "Buy zone " + session_name;
BZW = "Buy zone width " + session_name;
SZ = "Sell zone " + session_name;
SZW = "Sell zone width " + session_name;
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----


//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{

//----
int i, dayi, counted_bars = IndicatorCounted();
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{

if( TimeDay(Time[i]) != TimeDay(Time[i+1]) ) { int t = i ; }

opn[i] = iOpen(NULL,PERIOD_D1,i);


lgb[i] = opn[i]+(straddle_width+channel)*Point ;


shb[i] = opn[i]-(straddle_width+channel)*Point ;

}

//----
return(0);
}
//+------------------------------------------------------------------+
  • Post #2
  • Quote
  • Jan 15, 2009 2:00am Jan 15, 2009 2:00am
  •  nebuman213
  • | Joined Jan 2009 | Status: Member | 305 Posts
AHHHH!!!! This is driving me insane...so simple yet...!!
 
 
  • Post #3
  • Quote
  • Jan 15, 2009 4:41am Jan 15, 2009 4:41am
  •  trendchaser
  • | Membership Revoked | Joined Oct 2007 | 2,124 Posts
what i would do, is just add the levels to this mtf ma indy
Attached File(s)
File Type: mq4 MovingAverage MTF.mq4   4 KB | 287 downloads
 
 
  • Post #4
  • Quote
  • Jan 15, 2009 12:04pm Jan 15, 2009 12:04pm
  •  nebuman213
  • | Joined Jan 2009 | Status: Member | 305 Posts
I am trying to copy and paste pieces of the code levels I think need to go to the Indy above but I get a bunncchh of errors...what exactly do I need to change?
 
 
  • Post #5
  • Quote
  • Last Post: Jan 15, 2009 6:58pm Jan 15, 2009 6:58pm
  •  nebuman213
  • | Joined Jan 2009 | Status: Member | 305 Posts
Case Closed I got it.
 
 
  • Platform Tech
  • /
  • Indicator fix...code included.. WHATS WRONG?!?
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023