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

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Trend is your friend - supertrend indicator discussion 17 replies

Why your broker is your friend and your enemy 4 replies

Trend is your friend - Supertrend indicator discussion 6 replies

How to Call THV3 Trend indicator by using iCustom 2 replies

The trend is your friend: if you dont miss the boat 13 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: trend is your friend indicator & icustom()
Cancel

trend is your friend indicator & icustom()

  • Post #1
  • Quote
  • First Post: Feb 8, 2013 1:47pm Feb 8, 2013 1:47pm
  •  tugabulls
  • | Joined May 2010 | Status: Member | 31 Posts
Hi

I use the indicator above to help me find the trend, but when I use it on a EA using icustom() function, it donīt returns the same value displayed on the screen. Can anyone give me some clue of what could be happen?
Thanks

+++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Black
#property indicator_color2 Blue
#property indicator_width2 3
#property indicator_color3 Red
#property indicator_width3 3

extern int extremePeriods = 30;
extern string fx_pair = "EURUSD";
extern int timeframe = 240;
double buffer00[];
double buffer01[];
double buffer02[];

int init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexStyle(2, DRAW_LINE);
IndicatorDigits(Digits + 1);
SetIndexBuffer(0, buffer00);
SetIndexBuffer(1, buffer01);
SetIndexBuffer(2, buffer02);
IndicatorShortName("Trend is your friend TF");
SetIndexLabel(0, "Black");
SetIndexLabel(1, "Blue");
SetIndexLabel(2, "Red");
return (0);
}

int start() {

double ld_8;
double ld_16;
double avgLowHigh;
int counted_bars = IndicatorCounted();
double expressao01 = 0;
double ld_40 = 0;
double ld_unused_48 = 0;
double ld_unused_56 = 0;
double ld_64 = 0;
double ld_unused_72 = 0;
double aux_Low = 0;
double aux_High = 0;
double act_High = 0;
double act_Low = 0;
if (counted_bars > 0) counted_bars--;
int limit = Bars - counted_bars;
for (int i = 0; i < limit; i++) {
aux_High = iHigh(fx_pair,timeframe,iHighest(fx _pair, timeframe, MODE_HIGH, extremePeriods, i));
aux_Low = iLow(fx_pair, timeframe,iLowest(fx_pair, timeframe, MODE_LOW, extremePeriods, i));
act_High = iMA(fx_pair,timeframe,1,0,MODE_SMA, PRICE_HIGH,i);
act_Low = iMA(fx_pair,timeframe,1,0,MODE_SMA, PRICE_LOW,i);
avgLowHigh = (act_High + act_Low) / 2.0;
expressao01 = 0.66 * ((avgLowHigh - aux_Low) / (aux_High - aux_Low) - 0.5) + 0.67 * ld_40;
expressao01 = MathMin(MathMax(expressao01, -0.999), 0.999);
buffer00[i] = MathLog((expressao01 + 1) / (1 - expressao01)) / 2.0 + ld_64 / 2.0;
ld_40 = expressao01;
ld_64 = buffer00[i];
}
bool li_108 = TRUE;
for (i = limit - 2; i >= 0; i--) {
ld_16 = buffer00[i];
ld_8 = buffer00[i + 1];
if ((ld_16 < 0.0 && ld_8 > 0.0) || ld_16 < 0.0) li_108 = FALSE;
if ((ld_16 > 0.0 && ld_8 < 0.0) || ld_16 > 0.0) li_108 = TRUE;
if (!li_108) {
buffer02[i] = ld_16;
buffer01[i] = 0.0;
} else {
buffer01[i] = ld_16;
buffer02[i] = 0.0;
}
}
return (0);
}
  • Platform Tech
  • /
  • trend is your friend indicator & icustom()
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • X
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
  • X

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

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

Terms of Service / ©2023