Forex
Google

Go Back   Forex Trading > Discussion Areas > Setup Questions
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-03-2006, 06:18 PM
nicugh nicugh is offline
Junior Member
 
Join Date: Dec 2005
Posts: 1
nicugh is on a distinguished road
Help adding OBJ_TREND to indicator

//+------------------------------------------------------------------+
//| S_R trendline.mq4 |
//| Copyright © 2005, nicugh |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, nicugh"
#property link ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue

//---- buffers
double v1[];
double v2[];
double val1;
double val2;
int i;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

IndicatorBuffers(2);

//---- drawing settings

SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0,"Resistance");

ObjectCreate("Resistance", OBJ_TREND, 0, 0,v1[i],CurTime(),v1[i]);
//my problem is I can not create OBJ_TREND automaticaly
//it is created by the buffer's values only if it is compiled
//else (price 1=0, price2=0)
// and it is moved on the last line only when compiled
//I am not a programmer, can you help me, thank you

SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,i-1);
SetIndexBuffer(1, v2);
SetIndexLabel(1,"Support");

ObjectCreate("Support", OBJ_TREND, 0, 0,v2[i],CurTime(),v2[i]);
//my problem is I can not create OBJ_TREND automaticaly
//it is created by the buffer's values only if it is compiled
//else (price 1=0, price2=0)
// and it is moved on the last line only when compiled
//I am not a programmer, can you help me, thank you
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("Resistance");
ObjectDelete("Support");

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

int start()
{
// int counted_bars=IndicatorCounted();

i=Bars;
while(i>=0)
{

val1 = iFractals(NULL, 0, MODE_UPPER,i);
if (val1 > 0)
v1[i]=High[i];
else
v1[i] = v1[i+1];

val2 = iFractals(NULL, 0, MODE_LOWER,i);
if (val2 > 0)
v2[i]=Low[i];
else
v2[i] = v2[i+1];

i--;
}

}
//+------------------------------------------------------------------+

//my problem is I can not create OBJ_TREND automaticaly
//it is created by the buffer's values only if it is compiled
//else (price 1=0, price2=0)
// and it is moved on the last line only when compiled
//I am not a programmer, can you help me, thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with adding colour to TSI indicator drgoodvibe Indicators - Metatrader 4 3 11-26-2006 04:18 AM
Adding MA to an Indicator PeaceLover Metatrader 4 10 09-18-2006 06:18 PM
help adding indicator as filter and to modify EAs Aaragorn Setup Questions 24 06-30-2006 10:01 AM
Help Adding Indicator To Expert jpsdyb Setup Questions 11 06-29-2006 02:42 AM
problem with adding indicator shiningstar Indicators - Metatrader 4 11 05-19-2006 03:25 PM


All times are GMT. The time now is 10:14 AM.