Your message to me I can give you the full code directly.....
That won't be for free. For that you have to use Jobs section and pay to get it...
Isn't that clear intention to sell? So no more pm for me I guess, is it?
I am truly shocked !
Please calm down. You have to deal with how others can interpret your writings. And it's available to everyone. The message you highlighted from deVries is more than 1 year ago, and I am not even moderator at this time.
angevoyageur:
Please calm down. You have to deal with how others can interpret your writings. And it's available to everyone. The message you highlighted from deVries is more than 1 year ago, and I am not have moderator at this time.
No worries man. I've got your other post tonight and hope you can make the change you promissed. Good luck and I'll do my best as well.
then I've set an array for names and an array for price value for each pivot.
Then, if new day, I 'got the text object deleted with
and create them again with
If you're interested, I can post the file or the code. Maybe you can improve on it.
Improve on it !!??
I doubt that, I will have to understand it first :D
Thanks for posting your code, it is good to see examples of this new fangled MT4 code.
I had very little experience of coding before learning mql4. Many years ago, I did some coding in Basic on a ZX Spectrum.
I am relieved that so much of the old code still works, but without a "Book" that helps with learning all the new stuff, it is very difficult to understand all the new stuff.
We need a "Coding build 600+ for Dummies", perhaps you could write it ? :)
//+------------------------------------------------------------------+//| ProjectName |//| Copyright 2012, CompanyName |//| http://www.companyname.net |//+------------------------------------------------------------------+#property copyright"MT4"#include <stdlib.mqh>
#define R3_NAME "Daily R3"#define R2_NAME "Daily R2"#define R1_NAME "Daily R1"#define PIVOT_NAME "Daily PP"#define S1_NAME "Daily S1"#define S2_NAME "Daily S2"#define S3_NAME "Daily S3"//#property indicator_chart_window#property indicator_buffers7//---inputint Daily_or_Fibonacci_Pivots_12=1;
inputstring InpFont="Arial"; // Fontinputint InpFontSize=10; // Font sizeinputcolor InpColor1=clrRed; // Colorinputcolor InpColor2=clrWhite; // Colorinputcolor InpColor3=clrYellow; // Colorinputdouble InpAngle=0.0; // Slope angle in degreesinputENUM_ANCHOR_POINT InpAnchor=ANCHOR_BOTTOM; // Anchor typeinputbool InpBack=false; // Background objectinputbool InpSelection=false; // Highlight to moveinputbool InpHidden=false; // Hidden in the object listinputlong InpZOrder=0; // Priority for mouse clickinputint InpLineStyle=0; // Line styleinputint InpLineWidth=1; // Input(s)inputint Shift_Hrs=0; // Pivot day shiftinputint ChartShift = 20;
inputint LabelShift =7;
color InpColor;
// Buffers for levelsdouble Res3[],Res2[],Res1[],Pivot[],Sup1[],Sup2[],Sup3[];
double pivotArray[8];
string nameArray[]={"Daily R3","Daily R2","Daily R1","Daily PP","Daily S1","Daily S2","Daily S3"};
double PDayHigh,PDayLow;
datetime PivotDayStartTime,objectTextTime,prevTime;
int DayStartBar,LeftMostBar,RightMostBar,ShiftHrs;
bool flag=false;
//--------------------------------------------------------------------// Initialization//--------------------------------------------------------------------int init()
{
// Attach indicator arrays to buffersSetIndexBuffer(0,Res3);
SetIndexBuffer(1,Res2);
SetIndexBuffer(2,Res1);
SetIndexBuffer(3,Pivot);
SetIndexBuffer(4,Sup1);
SetIndexBuffer(5,Sup2);
SetIndexBuffer(6,Sup3);
// Set stylesSetIndexStyle(0,DRAW_LINE,InpLineStyle,InpLineWidth,InpColor1);
SetIndexStyle(1,DRAW_LINE,InpLineStyle,InpLineWidth,InpColor1);
SetIndexStyle(2,DRAW_LINE,InpLineStyle,InpLineWidth,InpColor1);
SetIndexStyle(3,DRAW_LINE,InpLineStyle,InpLineWidth,InpColor2);
SetIndexStyle(4,DRAW_LINE,InpLineStyle,InpLineWidth,InpColor3);
SetIndexStyle(5,DRAW_LINE,InpLineStyle,InpLineWidth,InpColor3);
SetIndexStyle(6,DRAW_LINE,InpLineStyle,InpLineWidth,InpColor3);
// Set empty valuesSetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexEmptyValue(2,EMPTY_VALUE);
SetIndexEmptyValue(3,EMPTY_VALUE);
SetIndexEmptyValue(4,EMPTY_VALUE);
SetIndexEmptyValue(5,EMPTY_VALUE);
SetIndexEmptyValue(6,EMPTY_VALUE);
// Catch bad input
ShiftHrs=Shift_Hrs;
if(MathAbs(ShiftHrs)>23)
{
Alert("ShiftHrs is too large. Reset to 0 hrs. ");
ShiftHrs=0;
}
PivotDayStartTime=Time[Bars-1]; // the first barreturn(0);
}
//--------------------------------------------------------------------//| De-initialization |//--------------------------------------------------------------------int deinit()
{
// Remove texts
DeleteLabels();
prevTime=0;
return(0);
}
//--------------------------------------------------------------------//| Main iteration |//--------------------------------------------------------------------int start()
{
int i,Count;
double Range;
if(ChartShiftSizeGet()<ChartShift)ChartShiftSizeSet(ChartShift);
i=Bars-IndicatorCounted()-1;
while(i>=0)
{
// If the pivot day changes...if(PivotDay(Time[i+1],ShiftHrs)!=PivotDay(Time[i],ShiftHrs))// what day of the week is it ?
{
// Determine High & Low for the previous Pivot Day
Count = iBarShift( NULL, 0, PivotDayStartTime ) - i; // number of bars in the day
PDayHigh = High[ iHighest( NULL, 0, MODE_HIGH, Count, i+1 ) ]; // Pivot Day high
PDayLow = Low[ iLowest( NULL, 0, MODE_LOW, Count, i+1 ) ]; // Pivot Day low// Pivot calculationsif(Daily_or_Fibonacci_Pivots_12==1)
{
Pivot[i]=(PDayHigh+PDayLow+Close[i+1])/3; // Pivot point
Range=PDayHigh-PDayLow;
Res1[i] = 2 * Pivot[i] - PDayLow; // R1
Res2[i] = Pivot[i] + Range; // R2
Res3[i] = Res1[i] + Range; // R3
Sup1[i] = 2 * Pivot[i] - PDayHigh; // S1
Sup2[i] = Pivot[i] - Range; // S2
Sup3[i] = Sup1[i] - Range; // S3
}
else
{
Pivot[i]=(PDayHigh+PDayLow+Close[i+1])/3; // Pivot point
Range=PDayHigh-PDayLow;
Res1[i] = Pivot [i]+ (Range * 0.382);
Res2[i] = Pivot [i]+ (Range * 0.618);
Res3[i] = Pivot [i]+ Range;
Sup1[i] = Pivot [i]- (Range * 0.382);
Sup2[i] = Pivot [i]- (Range * 0.618);
Sup3[i] = Pivot [i]- Range;
}
// Don't draw the transition between levels
Res3[i+1] = EMPTY_VALUE;
Res2[i+1] = EMPTY_VALUE;
Res1[i+1] = EMPTY_VALUE;
Pivot[i+1]= EMPTY_VALUE;
Sup1[i+1] = EMPTY_VALUE;
Sup2[i+1] = EMPTY_VALUE;
Sup3[i+1] = EMPTY_VALUE;
// Remember when the Day changed over
PivotDayStartTime=Time[i];
}
else// no change to pivot levels
{
Res3[i] = Res3[i+1];
Res2[i] = Res2[i+1];
Res1[i] = Res1[i+1];
Pivot[i]= Pivot[i+1];
Sup1[i] = Sup1[i+1];
Sup2[i] = Sup2[i+1];
Sup3[i] = Sup3[i+1];
}
//get levels for text objectsArrayInitialize(pivotArray,0.0);
pivotArray[0]=Res3[i];
pivotArray[1]=Res2[i];
pivotArray[2]=Res1[i];
pivotArray[3]=Pivot[i];
pivotArray[4]=Sup1[i];
pivotArray[5]=Sup2[i];
pivotArray[6]=Sup3[i];
i--;
}
// Put text on the chart
objectTextTime=Time[0]+(_Period*60*LabelShift);//set shift from Time[0]if(CountTextObjects()<7 | prevTime!=Time[0])// if chart time frame has changed or indicator just initialized
{
DeleteLabels();
for(int x=0;x<7;x++)//create text objects
{
if(x==3)InpColor=InpColor2;if(x<3)InpColor=InpColor1;if(x>3)InpColor=InpColor3;// set different colors for text objects
TextCreate(0,nameArray[x],0,objectTextTime,pivotArray[x],nameArray[x],InpFont,InpFontSize,
InpColor,InpAngle,InpAnchor,InpBack,InpSelection,InpHidden,InpZOrder);
}
prevTime=Time[0];
}
//---return(0);
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+int CountTextObjects()
{
int count=0;
for(int a=0;a<7;a++)
{
if(ObjectFind(0,nameArray[a])<0)continue;
count++;
}
return(count);
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+void DeleteLabels()
{
for(int a=0;a<7;a++)
{
if(ObjectFind(0,nameArray[a])<0)continue;
if(TextDelete(0,nameArray[a])==true)Print("1_Deleting "+nameArray[a]);
}
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+int PivotDay(datetime barTime,datetime shiftHrs)
{
int PDay=TimeDayOfWeek(barTime+shiftHrs*3600);
if( PDay == 0 ) PDay = 1; // Count Sunday as Mondayif( PDay == 6 ) PDay = 5; // Count Saturday as Fridayreturn( PDay );
}
//+---------------------------------------------------------------------------+//| The function receives shift size of the zero bar from the right border |//| of the chart in percentage values (from 10% up to 50%). |//+---------------------------------------------------------------------------+double ChartShiftSizeGet(constlong chart_ID=0)
{
//--- prepare the variable to get the resultdouble result=EMPTY_VALUE;
//--- reset the error valueResetLastError();
//--- receive the property valueif(!ChartGetDouble(chart_ID,CHART_SHIFT_SIZE,0,result))
{
//--- display the error message in Experts journalPrint(__FUNCTION__+", Error Code = ",ErrorDescription(GetLastError()));
}
//--- return the value of the chart propertyreturn(result);
}
//+--------------------------------------------------------------------------------------+//| The function sets the shift size of the zero bar from the right |//| border of the chart in percentage values (from 10% up to 50%). To enable the shift |//| mode, CHART_SHIFT property value should be set to |//| true. |//+--------------------------------------------------------------------------------------+bool ChartShiftSizeSet(constdouble value,constlong chart_ID=0)
{
//--- reset the error valueResetLastError();
//--- set property valueif(!ChartSetDouble(chart_ID,CHART_SHIFT_SIZE,value))
{
//--- display the error message in Experts journalPrint(__FUNCTION__+", Error Code = ",ErrorDescription(GetLastError()));
return(false);
}
//--- successful executionreturn(true);
}
//+------------------------------------------------------------------+//| Creating Text object |//+------------------------------------------------------------------+bool TextCreate(constlong chart_ID=0, // chart's IDconststring name="Text", // object nameconstint sub_window=0, // subwindow indexdatetime time=0, // anchor point timedouble price=0, // anchor point priceconststring text="Text", // the text itselfconststring font="Arial", // fontconstint font_size=10, // font sizeconstcolor clr=clrRed, // colorconstdouble angle=0.0, // text slopeconstENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER, // anchor typeconstbool back=false, // in the backgroundconstbool selection=false, // highlight to moveconstbool hidden=true, // hidden in the object listconstlong z_order=0) // priority for mouse click
{
//--- set anchor point coordinates if they are not set
ChangeTextEmptyPoint(time,price);
//--- reset the error valueResetLastError();
//--- create Text objectif(!ObjectCreate(chart_ID,name,OBJ_TEXT,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create "+name+" object! Error code = ",ErrorDescription(GetLastError()));
return(false);
}
//--- set the textObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
//--- set text fontObjectSetString(chart_ID,name,OBJPROP_FONT,font);
//--- set font sizeObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
//--- set the slope angle of the textObjectSetDouble(chart_ID,name,OBJPROP_ANGLE,angle);
//--- set anchor typeObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set colorObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- display in the foreground (false) or background (true)ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the object by mouseObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object listObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chartObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful executionreturn(true);
}
//+------------------------------------------------------------------+//| Check anchor point values and set default values |//| for empty ones |//+------------------------------------------------------------------+void ChangeTextEmptyPoint(datetime &time,double &price)
{
//--- if the point's time is not set, it will be on the current barif(!time)
time=TimeCurrent();
//--- if the point's price is not set, it will have Bid valueif(!price)
price=SymbolInfoDouble(Symbol(),SYMBOL_BID);
}
//+------------------------------------------------------------------+//| Delete Text object |//+------------------------------------------------------------------+bool TextDelete(constlong chart_ID=0, // chart's IDconststring name="Text") // object name
{
//--- reset the error valueResetLastError();
//--- delete the objectif(!ObjectDelete(chart_ID,name))
{
Print(__FUNCTION__,
": failed to delete "+name+" object! Error code = ",ErrorDescription(GetLastError()));
return(false);
}
//--- successful executionreturn(true);
}
//+------------------------------------------------------------------+
Are you serious?
If I had the intention to sell something, wouldn't I be the one to pm others?
Here is what the line just above your post says : " If you're interested, I can post the file or the code. Maybe you can improve on it."
Is this why most of my posts get deleted?
You don't have a problem with this:
"deVries 2013.02.02 12:28 #
Your message to me I can give you the full code directly.....
That won't be for free. For that you have to use Jobs section and pay to get it...
Isn't that clear intention to sell? So no more pm for me I guess, is it?
I am truly shocked !
Please calm down. You have to deal with how others can interpret your writings. And it's available to everyone. The message you highlighted from deVries is more than 1 year ago, and I am not have moderator at this time.
No worries man. I've got your other post tonight and hope you can make the change you promissed. Good luck and I'll do my best as well.
Cheers.
No worries man. I've got your other post tonight and hope you can make the change you promissed. Good luck and I'll do my best as well.
Cheers.
I have used a different approach :
1. Shifted the chart
using the :
then I've set an array for names and an array for price value for each pivot.
Then, if new day, I 'got the text object deleted with
and create them again with
If you're interested, I can post the file or the code. Maybe you can improve on it.
Improve on it !!??
I doubt that, I will have to understand it first :D
Thanks for posting your code, it is good to see examples of this new fangled MT4 code.
I had very little experience of coding before learning mql4. Many years ago, I did some coding in Basic on a ZX Spectrum.
I am relieved that so much of the old code still works, but without a "Book" that helps with learning all the new stuff, it is very difficult to understand all the new stuff.
We need a "Coding build 600+ for Dummies", perhaps you could write it ? :)
Are you serious?
If I had the intention to sell something, wouldn't I be the one to pm others?
Here is what the line just above your post says : " If you're interested, I can post the file or the code. Maybe you can improve on it."
Is this why most of my posts get deleted?
You don't have a problem with this:
"deVries 2013.02.02 12:28 #
Your message to me I can give you the full code directly.....
That won't be for free. For that you have to use Jobs section and pay to get it...
Isn't that clear intention to sell? So no more pm for me I guess, is it?
I am truly shocked !
Go read that whole topic and tell me what it is I'm doing wrong ....
did i say or wrote " you'll never get it done so pay up ".
leave the words in its contest they were written
no he asked me for the program i made to get it for free
it was not my intention to sell it
it was my intention helping him making that program on its own
if people want others programming their programs then they can go to Jobs
(and ofcours now they also can wait for the moment thrdel is making it for them )
Go read that whole topic and tell me what it is I'm doing wrong ....
did i say or wrote " you'll never get it done so pay up ".
leave the words in its contest they were written
no he asked me for the program i made to get it for free
it was not my intention to sell it
it was my intention helping him making that program on its own
if people want others programming their programs then they can go to Jobs
(and ofcours now they also can wait for the moment thrdel is making it for them )