• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 2:08am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 2:08am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Please help find bug in my code! 1 reply

Earn a Vouch - Find the Bug 12 replies

Can't find eachtickmode bug, please help 3 replies

Help - find the last 10 days ASK price 2 replies

How can I find These Values inorder to find resistance and support levels 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 3
Attachments: Range/Last = range in %... help find the bug...
Exit Attachments
Tags: Range/Last = range in %... help find the bug...
Cancel

Range/Last = range in %... help find the bug...

  • Post #1
  • Quote
  • First Post: Edited 10:08am Jul 1, 2012 9:41am | Edited 10:08am
  •  recidiviste
  • | Commercial Member | Joined May 2009 | 777 Posts
i am trying to filter some signals & found ATR a bit to much visited

had a simple idea to compare

(high-low)/close * 1000

i modified a code but not working well ...

there is a bug on weekend ; get false data ...

pls help ....

(if u can consider add some more functionality ma alert level .. )

t h a n k s



***************************

//+------------------------------------------------------------------+
//| Range in %.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "free"
#property link "free"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- input parameters
extern int AtrPeriod=1;
//---- buffers
double AtrBuffer[];
double TempBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 1 additional buffer used for counting.
IndicatorBuffers(2);
//---- indicator line
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,AtrBuffer);
SetIndexBuffer(1,TempBuffer);
//---- name for DataWindow and indicator subwindow label
short_name="range in %"+AtrPeriod+")";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
//----
SetIndexDrawBegin(0,AtrPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Average True Range |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=AtrPeriod) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=AtrPeriod;i++) AtrBuffer[Bars-i]=0.0;
//----
i=Bars-counted_bars-1;
while(i>=0)
{
double high=High[i];
double low =Low[i];
if(i==Bars-1) TempBuffer[i]=high-low;
else
{
double prevclose=Close[i+1];
TempBuffer[i]=(MathMax(high,prevclose)-MathMin(low,prevclose))/Close [i+1]*1000;
}
i--;
}
//----
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
for(i=0; i<limit; i++)
AtrBuffer[i]=iMAOnArray(TempBuffer,Bars,AtrPeriod,0,MODE_SMA,i);
//----
return(0);
}
//+------------------------------------------------------------------+
Attached Image (click to enlarge)
Click to Enlarge

Name: a1.jpg
Size: 239 KB
Attached File(s)
File Type: mq4 rangein%.mq4   2 KB | 197 downloads
BROKENGLISH
  • Post #2
  • Quote
  • Jul 1, 2012 1:28pm Jul 1, 2012 1:28pm
  •  cyber1
  • Joined Jan 2011 | Status: Member | 1,299 Posts
Are you sure its a bug?
There was a huge gap up on open of about 50 pips.
The wknd before over 100.
 
 
  • Post #3
  • Quote
  • Last Post: Jul 2, 2012 11:05am Jul 2, 2012 11:05am
  •  recidiviste
  • | Commercial Member | Joined May 2009 | 777 Posts
try this one i modified it a bit

think its great ...!
Attached File(s)
File Type: mq4 bar-range-info.mq4   3 KB | 195 downloads
BROKENGLISH
 
 
  • Platform Tech
  • /
  • Range/Last = range in %... help find the bug...
  • 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