Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4






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
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-13-2006, 12:14 AM
Kurka Fund's Avatar
Senior Member
 
Join Date: Sep 2006
Location: San Diego
Posts: 138
Kurka Fund is on a distinguished road
Supertrend

I am trying to use this indicator in an EA but cannot seem to get it to generate signals from it.....

here it is
PHP Code:
//+------------------------------------------------------------------+
//|                                                   Supertrend.mq4 |
//|                   Copyright © 2005, Jason Robinson (jnrtrading). |
//|                                      http://www.jnrtrading.co.uk |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Jason Robinson (jnrtrading)."
#property link      "http://www.jnrtrading.co.uk"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 HotPink
#property indicator_width1 2
#property indicator_width2 2

double TrendUp[];
double TrendDown[];
int st 0;
//extern int SlowerEMA = 6;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

   //SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   
SetIndexBuffer(0TrendUp);
   
//SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   
SetIndexBuffer(1TrendDown);
   
   
/*SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 159);
   SetIndexBuffer(0, TrendUp);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 159);
   SetIndexBuffer(1, TrendDown);*/
   
   /*for(int i = 0; i < Bars; i++) {
      TrendUp[i] = NULL;
      TrendDown[i] = NULL;
   }*/
//----
   
return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   /*for(int i = 0; i < Bars; i++) {
      TrendUp[i] = NULL;
      TrendDown[i] = NULL;
   }*/
//----
   
return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   
int limiticounter;
   
double RangeAvgRangecciTrendNowcciTrendPrevious, var;

   
int counted_bars IndicatorCounted();
//---- check for possible errors
   
if(counted_bars 0) return(-1);
//---- last counted bar will be recounted
   
if(counted_bars 0counted_bars--;

   
limit=Bars-counted_bars;
   
   for(
limit>= 0i--) {
      
cciTrendNow iCCI(NULL050PRICE_TYPICALi);
      
cciTrendPrevious iCCI(NULL050PRICE_TYPICALi+1);
      
      
//st = st * 100;
      
      
counter i;
      
Range 0;
      
AvgRange 0;
      for (
counter icounter >= i-9counter--) {
         
AvgRange AvgRange MathAbs(High[counter]-Low[counter]);
      }
      
Range AvgRange/10;
      if (
cciTrendNow >= st && cciTrendPrevious st) {
         
TrendUp[i+1] = TrendDown[i+1];
      }
      
      if (
cciTrendNow <= st && cciTrendPrevious st) {
         
TrendDown[i+1] = TrendUp[i+1];
      }
      
      if (
cciTrendNow >= st) {
         
TrendUp[i] = Low[i] - iATR(NULL05i);         
         if (
TrendUp[i] < TrendUp[i+1]) {
            
TrendUp[i] = TrendUp[i+1];
         }
      }
      else if (
cciTrendNow <= st) {
         
TrendDown[i] = High[i] + iATR(NULL05i);
         if (
TrendDown[i] > TrendDown[i+1]) {
            
TrendDown[i] = TrendDown[i+1];
         }
      }
   }
//----
   
return(0);
  }
//+------------------------------------------------------------------+ 
I am trying to code these statements....

PHP Code:
If (" supertrend is green " && Ask Supertrend) {
   
OPENBUY();
   }
If (
" supertrend is pink " && Bid Supertrend) {
   
OPENSELL();
   } 
What are the values of Supertrend? How do you distinguish Pink and Green?
But I cannot figure out how to get it working..... Thanks for your help.
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-13-2006, 08:10 AM
Kurka Fund's Avatar
Senior Member
 
Join Date: Sep 2006
Location: San Diego
Posts: 138
Kurka Fund is on a distinguished road
anybody ....
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-13-2006, 08:44 AM
eden159's Avatar
Member
 
Join Date: Jul 2006
Posts: 43
eden159 is on a distinguished road
Look at the iCustom() function.
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-13-2006, 01:29 PM
Senior Member
 
Join Date: Mar 2006
Posts: 789
Maji is on a distinguished road
This EA is just a clever way of drawing lines based on the CCI values as given by:

cciTrendNow = iCCI(NULL, 0, 50, PRICE_TYPICAL, i);
cciTrendPrevious = iCCI(NULL, 0, 50, PRICE_TYPICAL, i+1);

It has been defined previously in the code that st = 0;

Then, you have
if (cciTrendNow >= st && cciTrendPrevious < st) {
TrendUp[i+1] = TrendDown[i+1];
}

if (cciTrendNow <= st && cciTrendPrevious > st) {
TrendDown[i+1] = TrendUp[i+1];
}

Thus, just put in your own EA the equivalent of the CCI functions and consider it trendup signal when
cciTrendNow >= 0 && cciTrendPrevious < 0

and trenddown signal when
cciTrendNow <= st && cciTrendPrevious > st

This indicator is nothing more but a fancy way of showing on the screen CCI crossing the 0 line.
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
  #5 (permalink)  
Old 12-29-2006, 06:52 AM
Junior Member
 
Join Date: Apr 2006
Location: ranjang empuk
Posts: 18
ariefwahyudi is on a distinguished road
Anyone Have EA Of Supertrend ?
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
  #6 (permalink)  
Old 12-29-2006, 10:27 AM
Junior Member
 
Join Date: Apr 2006
Location: ranjang empuk
Posts: 18
ariefwahyudi is on a distinguished road
hi anybody have EA like SUPERTREND indicator ?
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

Tags
supertrend, www.jnrtrading.co.uk, SuperTrend Expert Advisor, super trend, supertrend ea, supertrend trading, supertrend forex

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
Supertrend as Histogram Hopexicerat Indicators - Metatrader 4 39 07-25-2009 05:00 PM
Anyone have Supertrend line Please? increase Indicators - Metatrader 4 24 02-23-2009 07:52 PM
Supertrend and RSTL cross hua Suggestions for Trading Systems 38 12-20-2007 06:06 PM


All times are GMT. The time now is 11:10 PM.



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