Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-27-2007, 07:03 PM
Junior Member
 
Join Date: Dec 2007
Posts: 5
inssuc is on a distinguished road
How to paint "Close[i]/High[i]" in seperate window?

hi everyone, when i try to draw a line of "(Close[i]-Low[i])/(High[i]-Low[i])", i get a very strange result. to my opinion, the line will wave between 0 and 1, but actual result is a straint line, i'm puzzled, can some one explain this?

here is my simple code:
//-----------------------------------------
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 White


double buffer1[];
int CountedBars=0;

int init()
{
SetIndexBuffer(0,buffer1);
return(0);
}

int start()
{
CountedBars=IndicatorCounted();
if(Bars<1) return(0);
for(int i=Bars-CountedBars;i>=0;i--)
{
buffer1[i]=(Close[i]-Low[i])/(High[i]-Low[i]);
}
}

Last edited by inssuc; 12-27-2007 at 07:43 PM. Reason: get new problem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 12-27-2007, 08:52 PM
fx1 fx1 is offline
Junior Member
 
Join Date: Nov 2005
Location: Pretoria , South Africa
Posts: 10
fx1 is on a distinguished road
Quote:
Originally Posted by inssuc View Post
hi everyone, when i try to draw a line of "(Close[i]-Low[i])/(High[i]-Low[i])", i get a very strange result. to my opinion, the line will wave between 0 and 1, but actual result is a straint line, i'm puzzled, can some one explain this?

here is my simple code:
//-----------------------------------------
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 White


double buffer1[];
int CountedBars=0;

int init()
{
SetIndexBuffer(0,buffer1);
return(0);
}

int start()
{
CountedBars=IndicatorCounted();
if(Bars<1) return(0);
for(int i=Bars-CountedBars;i>=0;i--)
{
if( (Close[i]-Low[i]) > 0 && (High[i]-Low[i]) > 0 )
}
}


add
if( (Close[i]-Low[i]) > 0 && (High[i]-Low[i]) > 0 )

above : if( (Close[i]-Low[i]) > 0 && (High[i]-Low[i]) > 0 )



like :


{

if( (Close[i]-Low[i]) > 0 && (High[i]-Low[i]) > 0 )
buffer1[i]=(Close[i]-Low[i])/(High[i]-Low[i]);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 12-27-2007, 09:13 PM
Junior Member
 
Join Date: Dec 2007
Posts: 5
inssuc is on a distinguished road
thanks

it works, thanks! but i still don't understand why the condition "High[i]-Low[i]>0" is needed? can High[i]<=Low[i] in sometime?

And, the line should be painted anyway, the condition is just tell mt4 when draw when not draw, why mt4 don't draw without the condition?

Last edited by inssuc; 12-27-2007 at 09:26 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 12-27-2007, 10:53 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by inssuc View Post
can High[i]<=Low[i] in sometime?
High[i] may equal Low[i] (first tick of a bar, or volume = 1 bar) then you divide by zero and the indic stops working.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to "teach" and to use the AI ("neuron") EA? danil Suggestions for Trading Systems 5 07-15-2008 05:26 PM
Are there no "and" "or" operators in mql4?? kxracer500 Metatrader 4 2 06-23-2007 09:14 AM
MT4 is there a "close all open trades script/command?" keramikus Metatrader 4 3 05-29-2007 02:49 PM
Lot sum after EA test / Avoid "CLOSE AT STOP" budhax Expert Advisors - Metatrader 4 4 02-16-2007 04:16 AM
what's the meaning of "close at stop"? phoenix General Discussion 2 06-24-2006 03:07 AM


All times are GMT. The time now is 12:07 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.