Alles um Metatrader 4.0 - Handelsmethoden und Indikatoren
-
-
-
-
-
Hab leider immer noch das Problem, dass der MTF Bollinger im 5M nicht exakt die Außenbänder des 1H ausgibt. Kann sich das mal jemand kurz ansehen, wo steckt da der Fehler?
//+------------------------------------------------------------------+
//| MTF_BollinderBands.mq4 |
//| Copyright © 2006, Keris2112 |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Keris2112"
#property link "http://www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 LawnGreen
#property indicator_color2 Yellow
#property indicator_color3 Yellow
//---- input parameters
/*************************************************************************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
PRICE_CLOSE 0 Close price.
PRICE_OPEN 1 Open price.
PRICE_HIGH 2 High price.
PRICE_LOW 3 Low price.
PRICE_MEDIAN 4 Median price, (high+low)/2.
PRICE_TYPICAL 5 Typical price, (high+low+close)/3.
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.
You must use the numeric value of the Applied Price that you want to use
when you set the 'applied_price' value with the indicator inputs.
---------------------------------------
MODE_SMA 0 Simple moving average,
MODE_EMA 1 Exponential moving average,
MODE_SMMA 2 Smoothed moving average,
MODE_LWMA 3 Linear weighted moving average.
You must use the numeric value of the MA Method that you want to use
when you set the 'ma_method' value with the indicator inputs.
**************************************************************************/
extern int TimeFrame=0;
extern int MAPeriod=3;// was 20
extern int BandsShift=0;
extern int StdDev=2;//was 2
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(2,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName(short_name+MAPeriod+") "+TimeFrameStr);
}
//----
return(0);
//+------------------------------------------------------------------+
//| MTF Moving Average |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined timeframe on to current timeframe
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars;
for(i=0,y=0;i<limit;i++)
{
if (Time<TimeArray[y]) y++;
/***********************************************************
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use 'TimeFrame' for the indicator timeframe
Rule 3: Use 'y' for the indicator's shift value
**********************************************************/
ExtMapBuffer1[i]=iBands(NULL,TimeFrame,MAPeriod,StdDev,BandsShift,PRICE_CLOSE,MODE_MAIN,y);
ExtMapBuffer2[i]=iBands(NULL,TimeFrame,MAPeriod,StdDev,BandsShift,PRICE_HIGH,MODE_UPPER,y);
ExtMapBuffer3[i]=iBands(NULL,TimeFrame,MAPeriod,StdDev,BandsShift,PRICE_LOW,MODE_LOWER,y);
}
//
return(0);
}
//+------------------------------------------------------------------+ -
-
-
-
Ich vermute mal hier das Problem:
datetime start;
if ( TimeGrid == PERIOD_W1 ) {
int weekCount = GridTime - 1;
int bar=0;
while ( weekCount >= 0 && bar < Bars ) {
if ( TimeDayOfWeek( Time[bar] ) == 1 && TimeHour( Time[bar] ) == 0 ) {
start = Time[bar];
gridname = "grid_" + DoubleToStr( start, 0 );
ObjectCreate( gridname, OBJ_VLINE, 0, start, 0 );
if ( TimeHour( start ) == ColorHour && TimeMinute( start ) == 0 )
ObjectSet( gridname, OBJPROP_COLOR, TimeLine2 );
else
ObjectSet( gridname, OBJPROP_COLOR, TimeLine );
ObjectSet( gridname, OBJPROP_STYLE, STYLE_SOLID );
ObjectSet( gridname, OBJPROP_TIME1, start );
ObjectSet( gridname, OBJPROP_BACK, true );
weekCount--; -
Leider klappt das mit meinem C noch nicht aussreichend, obwohl mir der Code nun schon ein wenig klarer ist. Habe hier das Oandaproblem, dass die Zeit +6 Stunden im MT4 läuft. Nun hab ich mal den Code des Grid V1 hier gepostet, weil ich vermute, dass irgendwo doch ein kleines -6 ausreichen müsste um die horizontale Zeiteinstellung passend zu machen. Ist das tatsächlich so oder muss hier gröberes umgeschrieben werden?
//+------------------------------------------------------------------+
//| Grid.mq4 |
//| 4xcoder |
//| 4xcoder@4xcoder.com |
//+------------------------------------------------------------------+
#property copyright "4xcoder"
#property link "4xcoder@4xcoder.com"
#property indicator_chart_window
//---- input parameters
extern int HGrid.Weeks=1000; // Period over which to calc High/Low of gird
extern int HGrid.Pips=1000; // Size of grid in Pips
extern color HLine=Gray; // Color of grid
extern color HLine2=Gray; // Every 100 pips, change grid color to this.
extern int GridTime=15; // Number of periods (days or weeks) to draw time grid
extern int TimeGrid=PERIOD_D1; // Grid period in minutes
extern int ColorHour=16; // For hour grids, draw color line at this hour (broker time)
extern color TimeLine=DimGray; // Color of grid
extern color TimeLine2=DarkGreen; // Color of special bars
// Recommends settings:
// 1 minute - HGrid.Pips=10, TimeGrid = 10
// 5, 15 minutes - HGrid.Pips=20, TimeGrid= PERIOD_H1 (60)
// 30, 60 minutes - HGrid.Pips=20, TimeGrid = PERIOD_H4 (240) or 2 hours (120)
// 4 hour - HGrid.Pips=50, TimeGrid = PERIOD_D1 (1440) or 12 hours (720)
// 1 day - HGrid.Pips=50, TimeGrid = PERIOD_W1 (10800).
bool firstTime = true;
datetime lastTime = 0;
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
if ( true /*lastTime == 0CurTime() - lastTime > 5*/ ) {
firstTime = false;
lastTime = CurTime();
if ( HGrid.Weeks > 0 && HGrid.Pips > 0 ) {
double weekH = iHigh( NULL, PERIOD_W1, 0 );
double weekL = iLow( NULL, PERIOD_W1, 0 );
for ( int i = 1; i < HGrid.Weeks; i++ ) {
weekH = MathMax( weekH, iHigh( NULL, PERIOD_W1, i ) );
weekL = MathMin( weekL, iLow( NULL, PERIOD_W1, i ) );
}
double pipRange = HGrid.Pips * Point;
if ( Symbol() == "GOLD" )
pipRange = pipRange * 10.0;
double topPips = (weekH + pipRange) - MathMod( weekH, pipRange );
double botPips = weekL - MathMod( weekL, pipRange );
for ( double p = botPips; p <= topPips; p += pipRange ) {
string gridname = "grid_" + DoubleToStr( p, Digits );
ObjectCreate( gridname, OBJ_HLINE, 0, 0, p );
double pp = p / Point;
int pInt = MathRound( pp );
int mod = 100;
if ( Symbol() == "GOLD" )
mod = 1000;
if ( (pInt % mod) == 0 )
ObjectSet( gridname, OBJPROP_COLOR, HLine2 );
else
ObjectSet( gridname, OBJPROP_COLOR, HLine );
ObjectSet( gridname, OBJPROP_STYLE, STYLE_SOLID );
ObjectSet( gridname, OBJPROP_PRICE1, p );
ObjectSet( gridname, OBJPROP_BACK, true );
}
}
}
datetime start;
if ( TimeGrid == PERIOD_W1 ) {
int weekCount = GridTime - 1;
int bar=0;
while ( weekCount >= 0 && bar < Bars ) {
if ( TimeDayOfWeek( Time[bar] ) == 1 && TimeHour( Time[bar] ) == 0 ) {
start = Time[bar];
gridname = "grid_" + DoubleToStr( start, 0 );
ObjectCreate( gridname, OBJ_VLINE, 0, start, 0 );
if ( TimeHour( start ) == ColorHour && TimeMinute( start ) == 0 )
ObjectSet( gridname, OBJPROP_COLOR, TimeLine2 );
else
ObjectSet( gridname, OBJPROP_COLOR, TimeLine );
ObjectSet( gridname, OBJPROP_STYLE, STYLE_SOLID );
ObjectSet( gridname, OBJPROP_TIME1, start );
ObjectSet( gridname, OBJPROP_BACK, true );
weekCount--;
}
bar++;
}
}
if ( TimeGrid > 0 ) {
start = Time[0];
int skip = TimeGrid * 60;
start = start - (start % skip) + skip;
int thisDay = TimeDay( start );
int dayCount = GridTime - 1;
while ( dayCount >= 0 ) {
gridname = "grid_" + DoubleToStr( start, 0 );
ObjectCreate( gridname, OBJ_VLINE, 0, start, 0 );
if ( TimeHour( start ) == ColorHour && TimeMinute( start ) == 0 )
ObjectSet( gridname, OBJPROP_COLOR, TimeLine2 );
else
ObjectSet( gridname, OBJPROP_COLOR, TimeLine );
ObjectSet( gridname, OBJPROP_STYLE, STYLE_SOLID );
ObjectSet( gridname, OBJPROP_TIME1, start );
ObjectSet( gridname, OBJPROP_BACK, true );
start = start - skip;
if ( TimeDay( start ) != thisDay ) {
dayCount--;
thisDay = TimeDay( start );
}
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
firstTime = true;
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
for ( int i = ObjectsTotal() - 1; i >= 0; i-- ) {
string name = ObjectName( i );
if ( StringFind( name, "grid_" ) >= 0 )
ObjectDelete( name );
}
//----
return(0);
}
//+------------------------------------------------------------------+ -
-
-
-
-
Es lassen sich sogar mehrere Paare handeln, einfach das Chartfenster anklicken und es erscheinen die Orderparameter des Paares. Auch kann man für jedes Paar verschiedene vordefinierte Pipeinstellungen für SL/TP festlegen. Ein zumindest brauchbarer Ersatz für die Javaversion von Oanda. Leider habe ich noch nicht herasgefunden wie man verschiedene Lotgrößen speichert.
-
toolsfortradingtheforex.com/aboutproduct.html
Interessantes Tool zum One-Clicken und funktioniert einwandfrei. -
-
Alle MT4 die ich kenne haben "nur" 1,5,15,30 min - 1 und 4 Stunden -täglich - wöchentlich und monatlich.
HarleyWer Rechtschreibfehler in meinen Beiträgen findet, darf sie gerne behalten!
candletrading.de/blog/category/tradingblogs/harley-fgbl/ -
-
Ich habs mir auch kurz angesehen. Was mir am meisten abgeht, ist die Möglichkeit, Chart-Fenster zu 'detachen' um sie auf einen anderen Monitor zu ziehen, wie schon mit mt4. Und es gibt nach wie vor nur Chart-Fenster, und keine tabellarischen Ausgabe-Fenster. Das Ganze ist leider noch weit entfernt von Bezahl-Software wie Multicharts oder Neoticker usw.
MQL dagegen scheint im 21. Jahrhundert angekommen zu sein, das sieht nach Fortschritt aus. Wobei mir noch immer nicht ganz klar ist, wieso man Ressourcen auf eigenes Sprach- und Compilerdesgin ver(sch)wendet.
-
Teilen
- Facebook 0
- Twitter 0
- Google Plus 0
-
Reddit 0
-
Benutzer online 6
6 Besucher