MQL4 - automated forex trading   /  

Code Base

Code Base  Indicators  Drive To post a new code, please log in or register

This library is for
MetaTrader 4
Download MT 4 - 3.5 Mb

Mobile trading!
Buy a license and be mobile in your trading!

Name:
Drive
Author: systrad5 (2006.09.08 14:46)
Rating: 1
Downloaded: 3213
Download:
 _Drive.mq4 (2.3 Kb) View

    Green above Red -> Up.

    Red above Green -> Down.

    Periods that seem useful are 4, 16, 128.

    Value is calculated as follows:

Up (Green) = ((High - Open) + (Close - Low))/2, averaged for the selected period;

Down (Red) = ((Open - Low) + (High - Close))/2, averaged for the selected period.



    This may have another name or be similar to an existing indicator. I've made up the name drive. Please drop me an email if you've run into a similar indicator before - systrad5@yahoo.com

1 comment  To post a new comment, please log in or register
#property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red //---- input parameters extern int Depth = 16; //---- buffers double UpBuffer[]; double DownBuffer[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { //---- additional buffers SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(0, UpBuffer); SetIndexStyle(1, DRAW_LINE); SetIndexBuffer(1, DownBuffer); //---- name for DataWindow and indicator subwindow label string short_name = "Drive(" + Depth + ")"; IndicatorShortName(short_name); SetIndexLabel(0, "DriveUp"); SetIndexLabel(1, "DriveDn"); //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int i, j; double UpCnt, DnCnt; if(Bars <= Depth + 10) return(0); //---- last counted bar will be recounted int counted_bars = IndicatorCounted(); int limit = Bars - counted_bars; if(counted_bars > 0) limit++; //---- Load prices into CBuffer[0] for(i = 0; i < limit; i++) { UpCnt = 0; DnCnt = 0; for(j = 0; j < Depth; j++) { UpCnt = UpCnt + (High[i+j] - Open[i+j]) + (Close[i+j] - Low[i+j]); DnCnt = DnCnt + (Open[i+j] - Low[i+j]) + (High[i+j] - Close[i+j]); } UpBuffer[i] = (UpCnt / (2 * Depth)) / Point; DownBuffer[i] = (DnCnt / (2 * Depth)) / Point; } return(0); } //+------------------------------------------------------------------+
16.09.2006 05:15 malamoudi