Suite au dernier action future j'ai vu un article sur vet indicateur. QQun l'utilise t'il? QQun a t'il le code sur prorealtime?
Annonce
Réduire
Aucune annonce.
Ads
Réduire
VWAP indicateur
Réduire
X
-
VWAP indicateur
un céréalier est un trader qui s'ignore souvent!!!
visitez mon blog: vendresonble http://vendresonble.wordpress.com/Tags: Aucun(e)
-
James Dalton "La logique créée l'impulsion, le temps produit le signal et la structure fournit la confirmation."
Retrouvez-moi aussi sur Twitter:@Uxxar
-
Olandeer, comme je vois que pour le VWAP, tu as une belle longueur d'avance sur nous, je me permet de demander...
Aurais tu le code de cette indicateur et des SD pour la platefome MT4 (impossible de mettre la main dessus).
Par ailleurs, existe il des informations sur la réussite de cet indicateur (backtest ou autre) ?
Merci par avance pour ta précieuse aide.
Commentaire
-
Citation de : pyassef (au 10-08-2009 10:21:05)
Olandeer, comme je vois que pour le VWAP, tu as une belle longueur d'avance sur nous, je me permet de demander...
Aurais tu le code de cette indicateur et des SD pour la platefome MT4 (impossible de mettre la main dessus).
Par ailleurs, existe il des informations sur la réussite de cet indicateur (backtest ou autre) ?
Merci par avance pour ta précieuse aide.
Je t' en prie !
Pour le code, je n' utilise pas mt4 par contre mon collègue "Caltonio" oui.
Tu imagines bien au regard du fossé qu' il existe entre les indicateurs connus backtestés et ceux méconnus tels le vwap non backtesté par le public, que je ne peux en dire plus et qu' il faut te faire une idée de l' utilisation que tu peux en faire selon tes connaissances et surtout ton horizon de trading... l' action fut que tu possèdes pourra te guider mais ensuite travail personnel
Rien de magique dans ce mean statistique mais une vérité, la moyenne du marché !!!
Bonne recherche...James Dalton "La logique créée l'impulsion, le temps produit le signal et la structure fournit la confirmation."
Retrouvez-moi aussi sur Twitter:@Uxxar
Commentaire
-
Allé c'est cadeau puisque que l'on me le réclame VWAP+MP mais je sais pas si vous le mérité vu l'aide en retour (de mauvaise humeur aujourd'hui navré ):
Cliquez pour agrandir
nb : si le code fonctionne pas signalé le et je retrouverai un lien.
//+------------------------------------------------------------------+
//| Market Profile & Vwap.mq4 |
//| Levoy Charles-Antoine |
//| http://trader-design.over-blog.com/ |
//+------------------------------------------------------------------+
#property copyright "Levoy Charles-Antoine"
#property link "http://trader-design.over-blog.com/"
//+------------------------------------------------------------------+
//| Market_Statistics.mq4 |
//| Copyright © 2009, Akif TOKUZ |
//| akifusenet@gmail.com |
//| Volume histogram implementation is based on Vadim Shumilov |
//| (DrShumiloff)'s VolumesHist2.3 indicator. Other concepts are |
//| inspired from Jperl's `Trading With Market Statistics` thread on |
//| Traders Laboratory. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Akif TOKUZ"
#property link "akifusenet@gmail.com"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red //PVP
#property indicator_width1 2
#property indicator_color2 Aqua //VWAP
#property indicator_width2 2
#property indicator_color3 Green //SD1Pos
#property indicator_width3 1
#property indicator_style3 2
#property indicator_color4 Red //SD1Neg
#property indicator_width4 1
#property indicator_style4 2
#property indicator_color5 DarkOliveGreen//SD2Pos
#property indicator_width5 1
#property indicator_style5 2
#property indicator_color6 Crimson //SD2Neg
#property indicator_width6 1
#property indicator_style6 2
#property indicator_color7 DarkGreen //SD2Pos
#property indicator_width7 1
#property indicator_style7 2
#property indicator_color8 FireBrick //SD2Neg
#property indicator_width8 1
#property indicator_style8 2
//---- input parameters
extern datetime StartDate=D'2009.08.06 00:00';
extern int HistogramAmplitude = 100;
extern bool Show_SD1 = true;
extern bool Show_SD2 = false;
extern bool Show_SD3 = false;
//---- buffers
double PVP[];
double VWAP[];
double SD1Pos[];
double SD1Neg[];
double SD2Pos[];
double SD2Neg[];
double SD3Pos[];
double SD3Neg[];
double Hist[]; // drawn specifically
datetime OpenTime = 0; // To check if we have a new bar
string OBJECT_PREFIX = "VolumeHistogram_";
int items; // numbers of items inside volume histogram
int Bars_Back = 0; // Shows the starting bar for given date
double SD; // standart deviation
// Finds the bar number for the given date
int FindStartIndex(datetime startDate)
{
for (int i=Bars-1; i>=0; i--)
{
if (Time>=StartDate) return (i);
}
return( 0);
}
int init()
{
Bars_Back=FindStartIndex(StartDate);
ObjectSet( "Starting_Time", OBJPROP_TIME1, Time[Bars_Back]);
ObjectSet("Starting_Time", OBJPROP_COLOR, Red);
ObjectCreate("Starting_Time", OBJ_VLINE, 0, Time[Bars_Back], 0);
//---- indicators
IndicatorBuffers(8);
SetIndexStyle(0,DRAW_LINE);
SetIndexLabel(0,"PVP");
SetIndexBuffer(0,PVP);
SetIndexStyle(1,DRAW_LINE);
SetIndexLabel(1,"VWAP");
SetIndexBuffer(1,VWAP);
if (Show_SD1==true) SetIndexStyle(2,DRAW_LINE);
else SetIndexStyle(2,DRAW_NONE);
SetIndexLabel(2,"SD1Pos");
SetIndexBuffer(2,SD1Pos);
if (Show_SD1==true) SetIndexStyle(3,DRAW_LINE);
else SetIndexStyle(3,DRAW_NONE);
SetIndexLabel(3,"SD1Neg");
SetIndexBuffer(3,SD1Neg);
if (Show_SD2==true) SetIndexStyle(4,DRAW_LINE);
else SetIndexStyle(4,DRAW_NONE);
SetIndexLabel(4,"SD2Pos");
SetIndexBuffer(4,SD2Pos);
if (Show_SD2==true) SetIndexStyle(5,DRAW_LINE);
else SetIndexStyle(5,DRAW_NONE);
SetIndexLabel(5,"SD2Neg");
SetIndexBuffer(5,SD2Neg);
if (Show_SD3==true) SetIndexStyle(6,DRAW_LINE);
else SetIndexStyle(6,DRAW_NONE);
SetIndexLabel(6,"SD3Pos");
SetIndexBuffer(6,SD3Pos);
if (Show_SD3==true) SetIndexStyle(7,DRAW_LINE);
else SetIndexStyle(7,DRAW_NONE);
SetIndexLabel(7,"SD3Neg");
SetIndexBuffer(7,SD3Neg);
string short_name="Market_Statistics";
IndicatorShortName(short_name);
return(0);
}
// Delete all objects with given prefix
void ObDeleteObjectsByPrefix(string Prefix)
{
int L = StringLen(Prefix);
int i = 0;
while(i < ObjectsTotal())
{
string ObjName = ObjectName(i);
if(StringSubstr(ObjName, 0, L) != Prefix)
{
i++;
continue;
}
ObjectDelete(ObjName);
}
}
int start()
{
double TotalVolume=0;
double TotalPV=0;
int n;
if (OpenTime != Open[0])
{
Bars_Back=FindStartIndex(StartDate);
//ObjectSet( "Starting_Time", OBJPROP_TIME1, Time[Bars_Back]);
OpenTime = Open[0];
double max = High[iHighest( NULL , 0, MODE_HIGH, Bars_Back, 0)];
double min = Low[ iLowest( NULL , 0, MODE_LOW, Bars_Back, 0)];
items = MathRound((max - min) / Point);
ArrayResize(Hist, items);
ArrayInitialize(Hist, 0);
TotalVolume=0;
TotalPV=0;
for (int i = Bars_Back; i >= 1; i--)
{
double t1 = Low, t2 = Open, t3 = Close, t4 = High;
if (t2 > t3) {t3 = Open; t2 = Close;}
double totalRange = 2*(t4 - t1) - t3 + t2;
if (totalRange != 0.0)
{
for (double Price_i = t1; Price_i <= t4; Price_i += Point)
{
n = MathRound((Price_i - min) / Point);
if (t1 <= Price_i && Price_i < t2)
{
Hist[n] += MathRound(Volume*2*(t2-t1)/totalRange);
}
if (t2 <= Price_i && Price_i <= t3)
{
Hist[n] += MathRound(Volume*(t3-t2)/totalRange);
}
if (t3 < Price_i && Price_i <= t4)
{
Hist[n] += MathRound(Volume*2*(t4-t3)/totalRange);
}
}//for
}else
{
// Check if all values are equal to each other
n = MathRound((t3 - min) / Point);
Hist[n] += Volume;
}//if
// use H+L+C/3 as average price
TotalPV+=Volume*((Low+High+Close)/3);
TotalVolume+=Volume;
if (i==Bars_Back) PVP=Close;
else PVP=min+ArrayMaximum(Hist)*Point;
if (i==Bars_Back) VWAP=Close;
else VWAP=TotalPV/TotalVolume;
SD=0;
for (int k = Bars_Back; k >= i; k--)
{
double avg=(High[k]+Close[k]+Low[k])/3;
double diff=avg-VWAP;
SD+=(Volume[k]/TotalVolume)*(diff*diff);
}
SD=MathSqrt(SD);
SD1Pos=VWAP+SD;
SD1Neg=VWAP-SD;
SD2Pos=SD1Pos+SD;
SD2Neg=SD1Neg-SD;
SD3Pos=SD2Pos+SD;
SD3Neg=SD2Neg-SD;
}//for
ObDeleteObjectsByPrefix(OBJECT_PREFIX);
int MaxVolume = Hist[ArrayMaximum(Hist)];
int multiplier;
for (i = 0; i <= items; i++)
{
// Protection if we have less bar than amplitude yet
if (Bars_Backelse multiplier=HistogramAmplitude;
if (MaxVolume != 0) Hist = MathRound(multiplier * Hist / MaxVolume );
if (Hist > 0)
{
int time_i = Bars_Back-Hist;
if (time_i>=0)
{
ObjectCreate(OBJECT_PREFIX+i, OBJ_RECTANGLE, 0, Time[Bars_Back], min + i*Point, Time[time_i], min + (i+1)*Point);
ObjectSet(OBJECT_PREFIX+i, OBJPROP_STYLE, DRAW_HISTOGRAM);
ObjectSet(OBJECT_PREFIX+i, OBJPROP_COLOR, Teal);
ObjectSet(OBJECT_PREFIX+i, OBJPROP_BACK, true);
}//if
} //if
}//for
}//MAIN IF BAR START
return(0);
}
int deinit()
{
ObDeleteObjectsByPrefix(OBJECT_PREFIX);
ObjectDelete("Starting_Time");
return(0);
}
Cliquez pour agrandir Computer day-trader sur contrats à terme
Mon twitter : CharlesAntoine Levoy
Commentaire
-
Essayez ce lien :
http://www.traderslaboratory.com/forums/f46/market...
Sinon un indic sur la force relative aussi peut vous intéressez peut-être :
Cliquez pour agrandir
Le code force relative futur DJ30 :
//+------------------------------------------------------------------+
//| Force Relative Dow Jones 30.mq4 |
//| Levoy Charles-Antoine |
//| http://trader-design.over-blog.com/ |
//+------------------------------------------------------------------+
#property copyright "Levoy Charles-Antoine"
#property link "http://trader-design.over-blog.com/"
#property indicator_chart_window
#property indicator_buffers 4
//Indicator Parameters
extern string SubSymbol = "DJ30";
extern color BullBarColor = DimGray;
extern color BearBarColor = DimGray;
extern color GridColor = DimGray;
//Global Variables
string Prefix; //Indicator Prefix
int Grid = 20; //Grid Lines
int SnapPips = 10; //Snap Pips For Grid Lines
//Indicator Buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
//Initialize Indexes
Prefix = "Force Relative" + SubSymbol;
IndicatorShortName( "Force Relative( " + SubSymbol + " )" );
SetIndexBuffer( 0, ExtMapBuffer1 );
SetIndexBuffer( 1, ExtMapBuffer2 );
SetIndexStyle( 0, DRAW_HISTOGRAM, DRAW_LINE, 1, BullBarColor );
SetIndexStyle( 1, DRAW_HISTOGRAM, DRAW_LINE, 1, BearBarColor );
SetIndexEmptyValue( 0, 0.0 );
SetIndexEmptyValue( 1, 0.0 );
return( 0 );
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
int _i;
//Delete Objects
ObjectDelete( Prefix + "Status" );
ObjectDelete( Prefix + "Copyright" );
for ( _i = 1; _i <= Grid ; _i ++ ) {
ObjectDelete( Prefix + "Grid" + _i );
ObjectDelete( Prefix + "Price" + _i );
}
return( 0 );
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int _BarsCount;
double _CurRangeHigh, _CurRangeLow, _CurRangeCenter;
double _SubRangeHigh, _SubRangeLow, _SubRangeCenter;
double _SubPoint, _SubDigit;
double _SubOpen, _SubHigh, _SubLow, _SubClose;
double _PipsRatio;
double _GridPips, _GridPrice;
int _i;
//Initialize Buffers
RefreshRates();
ArrayInitialize( ExtMapBuffer1, 0.0 );
ArrayInitialize( ExtMapBuffer2, 0.0 );
//Calculate Visible Bars
_BarsCount = BarsPerWindow() + 1;
int _FirstBar = FirstVisibleBar();
int _LastBar = _FirstBar - _BarsCount + 1;
if ( _LastBar < 0 ) {
_LastBar = 0;
_BarsCount = _FirstBar + 1;
}
//Calculate Chart Ratio
_CurRangeHigh = High[Highest(NULL, 0, MODE_HIGH, _BarsCount, _LastBar)];
_CurRangeLow = Low[Lowest(NULL, 0, MODE_LOW, _BarsCount, _LastBar)];
_CurRangeCenter = ( _CurRangeHigh + _CurRangeLow ) / 2;
_SubRangeHigh = iLow( SubSymbol, 0, Lowest( SubSymbol, 0, MODE_LOW, _BarsCount, _LastBar ) );
_SubRangeLow = iHigh( SubSymbol, 0, Highest( SubSymbol, 0, MODE_HIGH, _BarsCount, _LastBar ) );
_SubRangeHigh = iHigh( SubSymbol, 0, Highest( SubSymbol, 0, MODE_HIGH, _BarsCount, _LastBar ) );
_SubRangeLow = iLow( SubSymbol, 0, Lowest( SubSymbol, 0, MODE_LOW, _BarsCount, _LastBar ) );
_SubRangeCenter = ( _SubRangeHigh + _SubRangeLow ) / 2;
_SubPoint = MarketInfo( SubSymbol, MODE_POINT );
_SubDigit = MarketInfo( SubSymbol, MODE_DIGITS );
_PipsRatio = ( _CurRangeHigh - _CurRangeLow ) / ( _SubRangeHigh - _SubRangeLow );
_GridPips = ( _SubRangeHigh - _SubRangeLow ) / Grid;
_GridPips = MathRound( ( _SubRangeHigh - _SubRangeLow ) / Grid / ( _SubPoint * SnapPips ) ) * ( _SubPoint * SnapPips );
//Draw Bars
for ( _i = _LastBar; _i < _LastBar + _BarsCount; _i ++ ) {
_SubOpen = iOpen( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubHigh = iHigh( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubLow = iLow( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubClose = iClose( SubSymbol, 0, _i ) - _SubRangeCenter;
if ( _SubOpen < _SubClose ) {
ExtMapBuffer1[_i] = _CurRangeCenter + _SubHigh * _PipsRatio;
ExtMapBuffer2[_i] = _CurRangeCenter + _SubLow * _PipsRatio;
} else {
ExtMapBuffer1[_i] = _CurRangeCenter + _SubLow * _PipsRatio;
ExtMapBuffer2[_i] = _CurRangeCenter + _SubHigh * _PipsRatio;
}
}
//Draw Objects
ObjectCreate( Prefix + "Status", OBJ_LABEL, 0, 0, 0 );
ObjectSet( Prefix + "Status", OBJPROP_COLOR, GridColor );
ObjectSet( Prefix + "Status", OBJPROP_CORNER, 0 );
ObjectSet( Prefix + "Status", OBJPROP_XDISTANCE, 225 );
ObjectSet( Prefix + "Status", OBJPROP_YDISTANCE, 4 );
ObjectSetText( Prefix + "Status",
SubSymbol + " O = " + DoubleToStr( iOpen( SubSymbol, 0, _LastBar ), _SubDigit ) +
", H = " + DoubleToStr( iHigh( SubSymbol, 0, _LastBar ), _SubDigit ) +
", L = " + DoubleToStr( iLow( SubSymbol, 0, _LastBar ), _SubDigit ) +
", C = " + DoubleToStr( iClose( SubSymbol, 0, _LastBar ), _SubDigit ),
7 );
for ( _i = 1; _i <= Grid ; _i ++ ) {
_GridPrice = MathRound( _SubRangeCenter / ( _SubPoint * SnapPips ) ) * ( _SubPoint * SnapPips );
_GridPrice = ( ( _GridPrice + _GridPips / 2 ) + _GridPips * ( Grid / 2 - 1 ) ) - ( _GridPips * ( _i - 1 ) );
ObjectCreate( Prefix + "Price" + _i, OBJ_TEXT, 0, 0, 0 );
ObjectSet( Prefix + "Price" + _i, OBJPROP_TIME1, Time[_FirstBar - _BarsCount / 50] );
ObjectSet( Prefix + "Price" + _i, OBJPROP_PRICE1, _CurRangeCenter + ( _GridPrice - _SubRangeCenter ) * _PipsRatio );
ObjectSet( Prefix + "Price" + _i, OBJPROP_COLOR, GridColor );
ObjectSetText( Prefix + "Price" + _i, DoubleToStr( _GridPrice, _SubDigit ), 7 );
}
return( 0 );
}
//+------------------------------------------------------------------+
Cliquez pour agrandir
Le code force relative SP500 :
//+------------------------------------------------------------------+
//| Force Relative S&P 500.mq4 |
//| Levoy Charles-Antoine |
//| http://trader-design.over-blog.com/ |
//+------------------------------------------------------------------+
#property copyright "Levoy Charles-Antoine"
#property link "http://trader-design.over-blog.com/"
#property indicator_chart_window
#property indicator_buffers 4
//Indicator Parameters
extern string SubSymbol = "S&P";
extern color BullBarColor = SaddleBrown;
extern color BearBarColor = SaddleBrown;
extern color GridColor = SaddleBrown;
//Global Variables
string Prefix; //Indicator Prefix
int Grid = 20; //Grid Lines
int SnapPips = 10; //Snap Pips For Grid Lines
//Indicator Buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
//Initialize Indexes
Prefix = "Force Relative" + SubSymbol;
IndicatorShortName( "Force Relative( " + SubSymbol + " )" );
SetIndexBuffer( 0, ExtMapBuffer1 );
SetIndexBuffer( 1, ExtMapBuffer2 );
SetIndexStyle( 0, DRAW_HISTOGRAM, DRAW_LINE, 1, BullBarColor );
SetIndexStyle( 1, DRAW_HISTOGRAM, DRAW_LINE, 1, BearBarColor );
SetIndexEmptyValue( 0, 0.0 );
SetIndexEmptyValue( 1, 0.0 );
return( 0 );
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
int _i;
//Delete Objects
ObjectDelete( Prefix + "Status" );
ObjectDelete( Prefix + "Copyright" );
for ( _i = 1; _i <= Grid ; _i ++ ) {
ObjectDelete( Prefix + "Grid" + _i );
ObjectDelete( Prefix + "Price" + _i );
}
return( 0 );
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int _BarsCount;
double _CurRangeHigh, _CurRangeLow, _CurRangeCenter;
double _SubRangeHigh, _SubRangeLow, _SubRangeCenter;
double _SubPoint, _SubDigit;
double _SubOpen, _SubHigh, _SubLow, _SubClose;
double _PipsRatio;
double _GridPips, _GridPrice;
int _i;
//Initialize Buffers
RefreshRates();
ArrayInitialize( ExtMapBuffer1, 0.0 );
ArrayInitialize( ExtMapBuffer2, 0.0 );
//Calculate Visible Bars
_BarsCount = BarsPerWindow() + 1;
int _FirstBar = FirstVisibleBar();
int _LastBar = _FirstBar - _BarsCount + 1;
if ( _LastBar < 0 ) {
_LastBar = 0;
_BarsCount = _FirstBar + 1;
}
//Calculate Chart Ratio
_CurRangeHigh = High[Highest(NULL, 0, MODE_HIGH, _BarsCount, _LastBar)];
_CurRangeLow = Low[Lowest(NULL, 0, MODE_LOW, _BarsCount, _LastBar)];
_CurRangeCenter = ( _CurRangeHigh + _CurRangeLow ) / 2;
_SubRangeHigh = iLow( SubSymbol, 0, Lowest( SubSymbol, 0, MODE_LOW, _BarsCount, _LastBar ) );
_SubRangeLow = iHigh( SubSymbol, 0, Highest( SubSymbol, 0, MODE_HIGH, _BarsCount, _LastBar ) );
_SubRangeHigh = iHigh( SubSymbol, 0, Highest( SubSymbol, 0, MODE_HIGH, _BarsCount, _LastBar ) );
_SubRangeLow = iLow( SubSymbol, 0, Lowest( SubSymbol, 0, MODE_LOW, _BarsCount, _LastBar ) );
_SubRangeCenter = ( _SubRangeHigh + _SubRangeLow ) / 2;
_SubPoint = MarketInfo( SubSymbol, MODE_POINT );
_SubDigit = MarketInfo( SubSymbol, MODE_DIGITS );
_PipsRatio = ( _CurRangeHigh - _CurRangeLow ) / ( _SubRangeHigh - _SubRangeLow );
_GridPips = ( _SubRangeHigh - _SubRangeLow ) / Grid;
_GridPips = MathRound( ( _SubRangeHigh - _SubRangeLow ) / Grid / ( _SubPoint * SnapPips ) ) * ( _SubPoint * SnapPips );
//Draw Bars
for ( _i = _LastBar; _i < _LastBar + _BarsCount; _i ++ ) {
_SubOpen = iOpen( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubHigh = iHigh( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubLow = iLow( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubClose = iClose( SubSymbol, 0, _i ) - _SubRangeCenter;
if ( _SubOpen < _SubClose ) {
ExtMapBuffer1[_i] = _CurRangeCenter + _SubHigh * _PipsRatio;
ExtMapBuffer2[_i] = _CurRangeCenter + _SubLow * _PipsRatio;
} else {
ExtMapBuffer1[_i] = _CurRangeCenter + _SubLow * _PipsRatio;
ExtMapBuffer2[_i] = _CurRangeCenter + _SubHigh * _PipsRatio;
}
}
//Draw Objects
ObjectCreate( Prefix + "Status", OBJ_LABEL, 0, 0, 0 );
ObjectSet( Prefix + "Status", OBJPROP_COLOR, GridColor );
ObjectSet( Prefix + "Status", OBJPROP_CORNER, 0 );
ObjectSet( Prefix + "Status", OBJPROP_XDISTANCE, 225 );
ObjectSet( Prefix + "Status", OBJPROP_YDISTANCE, 4 );
ObjectSetText( Prefix + "Status",
SubSymbol + " O = " + DoubleToStr( iOpen( SubSymbol, 0, _LastBar ), _SubDigit ) +
", H = " + DoubleToStr( iHigh( SubSymbol, 0, _LastBar ), _SubDigit ) +
", L = " + DoubleToStr( iLow( SubSymbol, 0, _LastBar ), _SubDigit ) +
", C = " + DoubleToStr( iClose( SubSymbol, 0, _LastBar ), _SubDigit ),
7 );
for ( _i = 1; _i <= Grid ; _i ++ ) {
_GridPrice = MathRound( _SubRangeCenter / ( _SubPoint * SnapPips ) ) * ( _SubPoint * SnapPips );
_GridPrice = ( ( _GridPrice + _GridPips / 2 ) + _GridPips * ( Grid / 2 - 1 ) ) - ( _GridPips * ( _i - 1 ) );
ObjectCreate( Prefix + "Price" + _i, OBJ_TEXT, 0, 0, 0 );
ObjectSet( Prefix + "Price" + _i, OBJPROP_TIME1, Time[_FirstBar - _BarsCount / 50] );
ObjectSet( Prefix + "Price" + _i, OBJPROP_PRICE1, _CurRangeCenter + ( _GridPrice - _SubRangeCenter ) * _PipsRatio );
ObjectSet( Prefix + "Price" + _i, OBJPROP_COLOR, GridColor );
ObjectSetText( Prefix + "Price" + _i, DoubleToStr( _GridPrice, _SubDigit ), 7 );
}
return( 0 );
}
//+------------------------------------------------------------------+
Cliquez pour agrandir
Le code force relative Nasdaq :
//+------------------------------------------------------------------+
//| Force Relative Nasdaq.mq4 |
//| Levoy Charles-Antoine |
//| http://trader-design.over-blog.com/ |
//+------------------------------------------------------------------+
#property copyright "Levoy Charles-Antoine"
#property link "http://trader-design.over-blog.com/"
#property indicator_chart_window
#property indicator_buffers 4
//Indicator Parameters
extern string SubSymbol = "NAS100";
extern color BullBarColor = MidnightBlue;
extern color BearBarColor = MidnightBlue;
extern color GridColor = MidnightBlue;
//Global Variables
string Prefix; //Indicator Prefix
int Grid = 20; //Grid Lines
int SnapPips = 10; //Snap Pips For Grid Lines
//Indicator Buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
//Initialize Indexes
Prefix = "Force Relative" + SubSymbol;
IndicatorShortName( "Force Relative( " + SubSymbol + " )" );
SetIndexBuffer( 0, ExtMapBuffer1 );
SetIndexBuffer( 1, ExtMapBuffer2 );
SetIndexStyle( 0, DRAW_HISTOGRAM, DRAW_LINE, 1, BullBarColor );
SetIndexStyle( 1, DRAW_HISTOGRAM, DRAW_LINE, 1, BearBarColor );
SetIndexEmptyValue( 0, 0.0 );
SetIndexEmptyValue( 1, 0.0 );
return( 0 );
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
int _i;
//Delete Objects
ObjectDelete( Prefix + "Status" );
ObjectDelete( Prefix + "Copyright" );
for ( _i = 1; _i <= Grid ; _i ++ ) {
ObjectDelete( Prefix + "Grid" + _i );
ObjectDelete( Prefix + "Price" + _i );
}
return( 0 );
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int _BarsCount;
double _CurRangeHigh, _CurRangeLow, _CurRangeCenter;
double _SubRangeHigh, _SubRangeLow, _SubRangeCenter;
double _SubPoint, _SubDigit;
double _SubOpen, _SubHigh, _SubLow, _SubClose;
double _PipsRatio;
double _GridPips, _GridPrice;
int _i;
//Initialize Buffers
RefreshRates();
ArrayInitialize( ExtMapBuffer1, 0.0 );
ArrayInitialize( ExtMapBuffer2, 0.0 );
//Calculate Visible Bars
_BarsCount = BarsPerWindow() + 1;
int _FirstBar = FirstVisibleBar();
int _LastBar = _FirstBar - _BarsCount + 1;
if ( _LastBar < 0 ) {
_LastBar = 0;
_BarsCount = _FirstBar + 1;
}
//Calculate Chart Ratio
_CurRangeHigh = High[Highest(NULL, 0, MODE_HIGH, _BarsCount, _LastBar)];
_CurRangeLow = Low[Lowest(NULL, 0, MODE_LOW, _BarsCount, _LastBar)];
_CurRangeCenter = ( _CurRangeHigh + _CurRangeLow ) / 2;
_SubRangeHigh = iLow( SubSymbol, 0, Lowest( SubSymbol, 0, MODE_LOW, _BarsCount, _LastBar ) );
_SubRangeLow = iHigh( SubSymbol, 0, Highest( SubSymbol, 0, MODE_HIGH, _BarsCount, _LastBar ) );
_SubRangeHigh = iHigh( SubSymbol, 0, Highest( SubSymbol, 0, MODE_HIGH, _BarsCount, _LastBar ) );
_SubRangeLow = iLow( SubSymbol, 0, Lowest( SubSymbol, 0, MODE_LOW, _BarsCount, _LastBar ) );
_SubRangeCenter = ( _SubRangeHigh + _SubRangeLow ) / 2;
_SubPoint = MarketInfo( SubSymbol, MODE_POINT );
_SubDigit = MarketInfo( SubSymbol, MODE_DIGITS );
_PipsRatio = ( _CurRangeHigh - _CurRangeLow ) / ( _SubRangeHigh - _SubRangeLow );
_GridPips = ( _SubRangeHigh - _SubRangeLow ) / Grid;
_GridPips = MathRound( ( _SubRangeHigh - _SubRangeLow ) / Grid / ( _SubPoint * SnapPips ) ) * ( _SubPoint * SnapPips );
//Draw Bars
for ( _i = _LastBar; _i < _LastBar + _BarsCount; _i ++ ) {
_SubOpen = iOpen( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubHigh = iHigh( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubLow = iLow( SubSymbol, 0, _i ) - _SubRangeCenter;
_SubClose = iClose( SubSymbol, 0, _i ) - _SubRangeCenter;
if ( _SubOpen < _SubClose ) {
ExtMapBuffer1[_i] = _CurRangeCenter + _SubHigh * _PipsRatio;
ExtMapBuffer2[_i] = _CurRangeCenter + _SubLow * _PipsRatio;
} else {
ExtMapBuffer1[_i] = _CurRangeCenter + _SubLow * _PipsRatio;
ExtMapBuffer2[_i] = _CurRangeCenter + _SubHigh * _PipsRatio;
}
}
//Draw Objects
ObjectCreate( Prefix + "Status", OBJ_LABEL, 0, 0, 0 );
ObjectSet( Prefix + "Status", OBJPROP_COLOR, GridColor );
ObjectSet( Prefix + "Status", OBJPROP_CORNER, 0 );
ObjectSet( Prefix + "Status", OBJPROP_XDISTANCE, 225 );
ObjectSet( Prefix + "Status", OBJPROP_YDISTANCE, 4 );
ObjectSetText( Prefix + "Status",
SubSymbol + " O = " + DoubleToStr( iOpen( SubSymbol, 0, _LastBar ), _SubDigit ) +
", H = " + DoubleToStr( iHigh( SubSymbol, 0, _LastBar ), _SubDigit ) +
", L = " + DoubleToStr( iLow( SubSymbol, 0, _LastBar ), _SubDigit ) +
", C = " + DoubleToStr( iClose( SubSymbol, 0, _LastBar ), _SubDigit ),
7 );
for ( _i = 1; _i <= Grid ; _i ++ ) {
_GridPrice = MathRound( _SubRangeCenter / ( _SubPoint * SnapPips ) ) * ( _SubPoint * SnapPips );
_GridPrice = ( ( _GridPrice + _GridPips / 2 ) + _GridPips * ( Grid / 2 - 1 ) ) - ( _GridPips * ( _i - 1 ) );
ObjectCreate( Prefix + "Price" + _i, OBJ_TEXT, 0, 0, 0 );
ObjectSet( Prefix + "Price" + _i, OBJPROP_TIME1, Time[_FirstBar - _BarsCount / 10] );
ObjectSet( Prefix + "Price" + _i, OBJPROP_PRICE1, _CurRangeCenter + ( _GridPrice - _SubRangeCenter ) * _PipsRatio );
ObjectSet( Prefix + "Price" + _i, OBJPROP_COLOR, GridColor );
ObjectSetText( Prefix + "Price" + _i, DoubleToStr( _GridPrice, _SubDigit ), 7 );
}
return( 0 );
}
//+------------------------------------------------------------------+
Salutations.Computer day-trader sur contrats à terme
Mon twitter : CharlesAntoine Levoy
Commentaire
Commentaire