• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 12:57pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 12:57pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Looking for Stochastic Indicator - histogram style 11 replies

Need help changing indicator from histogram to line 2 replies

Price for changing Indicator to Histogram 3 replies

Need help changing colors on MACD histogram 1 reply

DMI Histogram style 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: Changing histogram style in code
Exit Attachments

Changing histogram style in code

  • Post #1
  • Quote
  • First Post: Dec 12, 2008 12:29am Dec 12, 2008 12:29am
  •  bsmile
  • | Joined Nov 2008 | Status: Member | 76 Posts
http://www.forexfactory.com/images/icons/icon5.gif Changing histogram style in code
I have the FXfish indicator, and want to change the style of the histogram bars. I want to just have vertical lines, without the slopes that are drawn. Below is the code for the original; how do I change the style to just achieve vertical bars from top to bottom of the window?
Thanks!

int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM,STYL E_SOLID,2,Lime);
SetIndexBuffer(0,buffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,STYL E_SOLID,2,Red);
SetIndexBuffer(1,buffer2);
return(0);
}
  • Post #2
  • Quote
  • Dec 12, 2008 1:46am Dec 12, 2008 1:46am
  •  thatwasme
  • Joined Feb 2008 | Status: Member | 403 Posts
Quoting bsmile
Disliked
http://www.forexfactory.com/images/icons/icon5.gif Changing histogram style in code
I have the FXfish indicator, and want to change the style of the histogram bars. I want to just have vertical lines, without the slopes that are drawn. Below is the code for the original; how do I change the style to just achieve vertical bars from top to bottom of the window?
Thanks!

int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM,STYL E_SOLID,2,Lime);
SetIndexBuffer(0,buffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,STYL E_SOLID,2,Red);
SetIndexBuffer(1,buffer2);
return(0);
}...
Ignored
You need to post the rest of the code, becuase the change is not in the set index it is that you would assign a static number to buffer1 and buffer2 . For example if your criteria is met for the first histogram
then buffer1[i] = 2. if the criteria for the second histogram is met, then buffer2[i] = 2. this forces the output to fill the entire window. Any static number will do, as long as they are the same for buffer1 and buffer2.
 
 
  • Post #3
  • Quote
  • Dec 12, 2008 2:11am Dec 12, 2008 2:11am
  •  bsmile
  • | Joined Nov 2008 | Status: Member | 76 Posts
Quoting thatwasme
Disliked
You need to post the rest of the code, becuase the change is not in the set index it is that you would assign a static number to buffer1 and buffer2 . For example if your criteria is met for the first histogram
then buffer1[i] = 2. if the criteria for the second histogram is met, then buffer2[i] = 2. this forces the output to fill the entire window. Any static number will do, as long as they are the same for buffer1 and buffer2.
Ignored
Sorry, here is the whole code:

// FX_FISH
#property copyright "Copyright 2005, Kiko Segui"
#property link "[email protected]"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_level1 0
#property indicator_level2 0.30
#property indicator_level3 -0.30

double buffer1[];
double buffer2[];

extern int period=12;
extern int price=0; // 0 or other = (H+L)/2
// 1 = Open
// 2 = Close
// 3 = High
// 4 = Low
// 5 = (H+L+C)/3
// 6 = (O+C+H+L)/4
// 7 = (O+C)/2
extern bool Mode_Fast= False;
extern bool Signals= True;

int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2,Lime);
SetIndexBuffer(0,buffer1);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2,Red);
SetIndexBuffer(1,buffer2);
return(0);
}

int deinit()
{
int i;
double tmp;


for (i=0;i<Bars;i++)
{
ObjectDelete("SELL SIGNAL: "+DoubleToStr(i,0));
ObjectDelete("BUY SIGNAL: "+DoubleToStr(i,0));
ObjectDelete("EXIT: "+DoubleToStr(i,0));
}
return(0);
}

double Value=0,Value1=0,Value2=0,Fish=0,Fish1=0,Fish2=0;
int buy=0,sell=0;
int start()
{
int i;
int barras;
double _price;
double tmp;

double MinL=0;
double MaxH=0;

double Threshold=1.2;
barras = Bars;
if (Mode_Fast)
barras = 100;
i = 0;
while(i<barras)
{
MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)];
MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)];

switch (price)
{
case 1: _price = Open[i]; break;
case 2: _price = Close[i]; break;
case 3: _price = High[i]; break;
case 4: _price = Low[i]; break;
case 5: _price = (High[i]+Low[i]+Close[i])/3; break;
case 6: _price = (Open[i]+High[i]+Low[i]+Close[i])/4; break;
case 7: _price = (Open[i]+Close[i])/2; break;
default: _price = (High[i]+Low[i])/2; break;
}


Value = 0.33*2*((_price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;
Value=MathMin(MathMax(Value,-0.999),0.999);
Fish = 0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;

buffer1[i]= 0;
buffer2[i]= 0;

if ( (Fish<0) && (Fish1>0))
{
if (Signals)
{
ObjectCreate("EXIT: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("EXIT: "+DoubleToStr(i,0),"EXIT AT "+DoubleToStr(_price,4),10,"Arial",White);
}
buy = 0;
}
if ((Fish>0) && (Fish1<0))
{
if (Signals)
{
ObjectCreate("EXIT: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("EXIT: "+DoubleToStr(i,0),"EXIT AT "+DoubleToStr(_price,4),10,"Arial",White);
}
sell = 0;
}

if (Fish>=0)
{
buffer1[i] = Fish;
}
else
{
buffer2[i] = Fish;
}

tmp = i;
if ((Fish<-Threshold) &&
(Fish>Fish1) &&
(Fish1<=Fish2))
{
if (Signals)
{
ObjectCreate("SELL SIGNAL: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("SELL SIGNAL: "+DoubleToStr(i,0),"SELL AT "+DoubleToStr(_price,4),10,"Arial",Red);
}
sell = 1;
}
if ((Fish>Threshold) &&
(Fish<Fish1) &&
(Fish1>=Fish2))
{
if (Signals)
{
ObjectCreate("BUY SIGNAL: "+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],_price);
ObjectSetText("BUY SIGNAL: "+DoubleToStr(i,0),"BUY AT "+DoubleToStr(_price,4),10,"Arial",Lime);
}
buy=1;
}
Value1 = Value;
Fish2 = Fish1;
Fish1 = Fish;

i++;
}
return(0);
}
//+------------------------------------------------------------------+
 
 
  • Post #4
  • Quote
  • Dec 12, 2008 3:37am Dec 12, 2008 3:37am
  •  thatwasme
  • Joined Feb 2008 | Status: Member | 403 Posts
Ok this fills the window.
Attached File
File Type: mq4 FX_FISH FullBAR.mq4   3 KB | 337 downloads
 
 
  • Post #5
  • Quote
  • Last Post: Dec 12, 2008 8:59am Dec 12, 2008 8:59am
  •  bsmile
  • | Joined Nov 2008 | Status: Member | 76 Posts
Quoting thatwasme
Disliked
Ok this fills the window.
Ignored
Thanks very much...that is just what I was trying to achieve.
 
 
  • Platform Tech
  • /
  • Changing histogram style in code
  • 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 / ©2022