Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

programmer

Balance Point - Bryce G's Idea

Recommended Posts

Hi Guys,

 

Code for TS/MC.

Trading purpose : Very strong sup/res analysis.

 

 

New here so I wanted to contribute some of my coding and ideas.

 

Having read Bryce Gylmore journals, I coded his Balance point idea.

This is my personal coding so no copyright issues will come up.

 

Hope this helps.

 

The code:

------------------------------------------------------------------

inputs: middle3dTLColor(Yellow), Use2Day(true),middle2dTLColor(Red),

UseYesterdayHL(true), middleYesterdayTLColor(Blue), Use4Day(true),middle4dTLColor(Magenta),

Use5Day(true),middle5dTLColor(Cyan), Use10Day(true),middle10dTLColor(Green) ;

Vars:numOfDays(0), isGlobex(false), SessionNum(0),

High3D(0), Low3D(0), middle3D(0),

prev3DHighTrendLine(0), prev3DHighText(0),

prev3DLowTrendLine(0), prev3DLowText(0),

middle3DTL(0), middle3DText(0), numOfPrevDays(4),

 

High2D(0), Low2D(0), middle2D(0),

prev2DHighTrendLine(-1), prev2DHighText(-1), prev2DLowTrendLine(-1), prev2DLowText(-1),

middle2DTL(-1), middle2DText(-1), numOfPrev2Days(3),

 

High1D(0), Low1D(0), middle1D(0),

prev1DHighTrendLine(-1), prev1DHighText(-1), prev1DLowTrendLine(-1), prev1DLowText(-1),

middle1DTL(-1), middle1DText(-1), numOfPrev1Days(2),

 

High4D(0), Low4D(0), middle4D(0),

prev4DHighTrendLine(-1), prev4DHighText(-1), prev4DLowTrendLine(-1), prev4DLowText(-1),

middle4DTL(-1), middle4DText(-1), numOfPrev4Days(5),

 

High5D(0), Low5D(0), middle5D(0),

prev5DHighTrendLine(-1), prev5DHighText(-1), prev5DLowTrendLine(-1), prev5DLowText(-1),

middle5DTL(-1), middle5DText(-1), numOfPrev5Days(6),

High10D(0), Low10D(0), middle10D(0),

prev10DHighTrendLine(-1), prev10DHighText(-1), prev10DLowTrendLine(-1), prev10DLowText(-1),

middle10DTL(-1), middle10DText(-1), numOfPrev10Days(11),

 

HighTrendLine(-1), HighText(-1), LowTrendLine(-1), LowText(-1),tempdaysback(0) ;

 

if lastbaronchart then begin

 

if (DayOfWeek(date) <6 and DayOfWeek(date)<>0) then

SessionNum = DayOfWeek(date)

else

SessionNum = 1;

 

isGlobex = InStr(symbolname,".D") > 0;

if (bartype <> 2) then begin

if (isGlobex=false) then begin

if ( SessionEndTime(1,SessionNum) = time and dayofweek(date) = 5) then

numOfDays = 1

else if (dayofweek(date) = 4 or dayofweek(date) = 5 or dayofweek(date) = 3 or dayofweek(date) = 2) then

numOfDays = 2

else if (dayofweek(date) = 1) then

numOfDays = 4

else if (dayofweek(date) = 6) then

numOfDays = 0

else if (dayofweek(date) = 0) then

numOfDays = 5;

end else begin

if ( SessionEndTime(1,SessionNum) = time) then begin

if (dayofweek(date) = 1) then

numOfDays = 3

else if (dayofweek(date) = 5) then

numOfDays = 0

else

numOfDays = 1;

end else begin

if ( dayofweek(date) = 4 or dayofweek(date) = 5 or dayofweek(date) = 3 or dayofweek(date) = 2) then

numOfDays = 1

else if (dayofweek(date) = 1) then

numOfDays = 3

else if (dayofweek(date) = 0 ) then

numOfDays = 4

else if (dayofweek(date) = 6) then

numOfDays =2;

end;

end;

end;

 

//3Days

High3D = MaxList(HighD(1), HighD(2), HighD(3));

Low3D = MinList(LowD(1), LowD(2), LowD(3));

if (DayOfWeek(currentDate) = 6 or DayOfWeek(currentDate) = 0) then begin

High3D = MaxList(HighD(0), HighD(1), HighD(2));

Low3D = MinList(LowD(0), LowD(1), LowD(2));

end else if((DayOfWeek(currentDate) = 1 or DayOfWeek(currentDate) = 2 or DayOfWeek(currentDate) = 3 )

and (bartype<>2 and isGlobex=false)) then begin

High3D = MaxList(HighD(1),HighD(2), HighD(3), HighD(4));

Low3D = MinList(LowD(1),LowD(2), LowD(3), LowD(4));

end;

middle3D = Low3D+(High3D-Low3D)/2;

tempdaysback = numOfDays+2;

if (dayofweek(date) = 3 or dayofweek(date) = 2) then begin

if (isGlobex=false) then

tempdaysback = 6

else

tempdaysback = 5;

end;

 

if (prev3DHighTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev3DHighTrendLine,JulianToDate(DateToJulian(Date[numOfPrevDays])), SessionStartTime(1,SessionNum), High3D)

else

TL_SetBegin(prev3DHighTrendLine,JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), High3D);

 

TL_SetEnd(prev3DHighTrendLine, Date, Time+2, High3D);

end else begin

if (bartype = 2) then

prev3DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrevDays])), SessionStartTime(1,SessionNum) , High3D, DATE, time+2 , High3D)

else

prev3DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , High3D, DATE, time+2 , High3D);

 

TL_SetColor(prev3DHighTrendLine, middle3dTLColor);

TL_SetStyle(prev3DHighTrendLine, 4);

end;

if (prev3DHighText > 0) then

Text_SetLocation (prev3DHighText, date, time+2 ,High3D)

else begin

prev3DHighText = Text_New(DATE, TIME+2 , High3D, " 3 Day High ("+numtostr(High3D,4)+")");

Text_SetStyle (prev3DHighText, 0, 2);

TEXT_SETCOLOR(prev3DHighText, middle3dTLColor);

end;

 

if (prev3DLowTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev3DLowTrendLine, JulianToDate(DateToJulian(Date[numOfPrevDays])), SessionStartTime(1,SessionNum), Low3D)

else

TL_SetBegin(prev3DLowTrendLine, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), Low3D);

TL_SetEnd(prev3DLowTrendLine, Date, Time+2, Low3D);

end else begin

if (bartype = 2) then

prev3DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrevDays])), SessionStartTime(1,SessionNum) , Low3D, DATE, time+2, Low3D)

else

prev3DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , Low3D, DATE, time+2, Low3D);

TL_SetColor(prev3DLowTrendLine, middle3dTLColor);

TL_SetStyle(prev3DLowTrendLine, 4);

end;

if (prev3DLowText > 0) then

Text_SetLocation (prev3DLowText, date, time+2 ,Low3D)

else begin

prev3DLowText = Text_New(DATE, TIME+2 , Low3D, " 3 Day Low ("+numtostr(Low3D,4)+")");

Text_SetStyle (prev3DLowText, 0, 2);

TEXT_SETCOLOR(prev3DLowText, middle3dTLColor);

end;

 

if (middle3DTL > 0) then begin

if (bartype = 2) then

TL_SetBegin(middle3DTL, JulianToDate(DateToJulian(Date[numOfPrevDays])), SessionStartTime(1,SessionNum), middle3D)

else

TL_SetBegin(middle3DTL, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), middle3D);

TL_SetEnd(middle3DTL, Date, Time+2, middle3D);

end else begin

if (bartype = 2) then

middle3DTL= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrevDays])), SessionStartTime(1,SessionNum) , middle3D, DATE, time+2, middle3D)

else

middle3DTL= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , middle3D, DATE, time+2, middle3D);

TL_SETSIZE(middle3DTL, 2);

TL_SetColor(middle3DTL, middle3dTLColor);

end;

if (middle3DText > 0) then

Text_SetLocation (middle3DText, date, time+2 ,middle3D)

else begin

middle3DText = Text_New(DATE, TIME+2 , middle3D, " 3 Day BPOINT ("+numtostr(middle3D,4)+")");

Text_SetStyle (middle3DText, 0, 2);

TEXT_SETCOLOR(middle3DText, middle3dTLColor);

end;

 

 

//2 days

if (Use2Day) then begin

High2D = MaxList(HighD(1), HighD(2));

Low2D = MinList(LowD(1), LowD(2));

if (DayOfWeek(currentDate) = 6 or DayOfWeek(currentDate) = 0) then begin

High2D = MaxList(HighD(0), HighD(1));

Low2D = MinList(LowD(0), LowD(1));

end else if((DayOfWeek(currentDate) = 1 or DayOfWeek(currentDate) = 2) and (bartype<>2 and isGlobex=false)) then begin

High2D = MaxList(HighD(1),HighD(2), HighD(3));

Low2D = MinList(LowD(1),LowD(2), LowD(3));

end;

middle2D = Low2D+(High2D-Low2D)/2;

 

tempdaysback = numOfDays+1;

if (dayofweek(date) = 2) then begin

if (isGlobex=false) then

tempdaysback = 5

else

tempdaysback = 4;

end;

 

if (prev2DHighTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev2DHighTrendLine, JulianToDate(DateToJulian(Date[numOfPrev2Days])), SessionStartTime(1,SessionNum), High2D)

else

TL_SetBegin(prev2DHighTrendLine, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), High2D);

 

TL_SetEnd(prev2DHighTrendLine, Date, Time+2, High2D);

end else begin

if (bartype = 2) then

prev2DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev2Days])), SessionStartTime(1,SessionNum) , High2D, DATE, time+2 , High2D)

else

prev2DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , High2D, DATE, time+2 , High2D);

 

TL_SetColor(prev2DHighTrendLine, middle2dTLColor);

TL_SetStyle(prev2DHighTrendLine, 4);

end;

if (prev2DHighText > 0) then

Text_SetLocation (prev2DHighText, date, time+2 ,High2D)

else begin

prev2DHighText = Text_New(DATE, TIME+2 , High2D, " 2 Day High ("+numtostr(High2D,4)+")");

Text_SetStyle (prev2DHighText, 0, 0);

TEXT_SETCOLOR(prev2DHighText, middle2dTLColor);

end;

 

if (prev2DLowTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev2DLowTrendLine, JulianToDate(DateToJulian(Date[numOfPrev2Days])), SessionStartTime(1,SessionNum), Low2D)

else

TL_SetBegin(prev2DLowTrendLine, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), Low2D);

TL_SetEnd(prev2DLowTrendLine, Date, Time+2, Low2D);

end else begin

if (bartype = 2) then

prev2DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev2Days])), SessionStartTime(1, SessionNum) , Low2D, DATE, time+2, Low2D)

else

prev2DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1, SessionNum) , Low2D, DATE, time+2, Low2D);

 

TL_SetColor(prev2DLowTrendLine, middle2dTLColor);

TL_SetStyle(prev2DLowTrendLine, 4);

end;

if (prev2DLowText > 0) then

Text_SetLocation (prev2DLowText, date, time+2 ,Low2D)

else begin

prev2DLowText = Text_New(DATE, TIME+2 , Low2D, " 2 Day Low ("+numtostr(Low2D,4)+")");

Text_SetStyle (prev2DLowText, 0, 0);

TEXT_SETCOLOR(prev2DLowText, middle2dTLColor);

end;

 

 

if (middle2DTL > 0) then begin

if (bartype = 2) then

TL_SetBegin(middle2DTL, JulianToDate(DateToJulian(Date[numOfPrev2Days])), SessionStartTime(1,SessionNum), middle2D)

else

TL_SetBegin(middle2DTL, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), middle2D);

 

TL_SetEnd(middle2DTL, Date, Time+2, middle2D);

end else begin

if (bartype = 2) then

middle2DTL= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev2Days])), SessionStartTime(1,SessionNum) , middle2D, DATE, time+2, middle2D)

else

middle2DTL= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , middle2D, DATE, time+2, middle2D);

TL_SETSIZE(middle2DTL, 2);

TL_SetColor(middle2DTL, middle2dTLColor);

end;

if (middle2DText > 0) then

Text_SetLocation (middle2DText, date, time+2 ,middle2D)

else begin

middle2DText = Text_New(DATE, TIME+2 , middle2D, " 2 Day BPOINT ("+numtostr(middle2D,4)+")");

Text_SetStyle (middle2DText, 0, 0);

TEXT_SETCOLOR(middle2DText, middle2dTLColor);

end;

end;

 

if (UseYesterdayHL) then begin

High1D = HighD(1);

Low1D = LowD(1);

if (DayOfWeek(currentDate) = 6 or DayOfWeek(currentDate) = 0) then begin

High1D =HighD(0);

Low1D = LowD(0);

end else if(DayOfWeek(currentDate) = 1 and (bartype<>2 and isGlobex=false)) then begin

High1D = MaxList(HighD(1), HighD(2));

Low1D = MinList(LowD(1), LowD(2));

end;

middle1D = Low1D+(High1D-Low1D)/2;

 

if (prev1DHighTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev1DHighTrendLine, JulianToDate(DateToJulian(Date[numOfPrev1Days])), SessionStartTime(1,SessionNum), High1D)

else

TL_SetBegin(prev1DHighTrendLine, JulianToDate(DateToJulian(Date)-numOfDays), SessionStartTime(1,SessionNum), High1D);

TL_SetEnd(prev1DHighTrendLine, Date, Time+2, High1D);

end else begin

if (bartype = 2) then

prev1DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev1Days])), SessionStartTime(1,SessionNum) , High1D, DATE, time+2 , High1D)

else

prev1DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays), SessionStartTime(1,SessionNum) , High1D, DATE, time+2 , High1D);

TL_SetColor(prev1DHighTrendLine, middleYesterdayTLColor);

TL_SetStyle(prev1DHighTrendLine, 4);

end;

if (prev1DHighText > 0) then

Text_SetLocation (prev1DHighText, date, time+2 ,High1D)

else begin

prev1DHighText = Text_New(DATE, TIME+2 , High1D, " 1 Day High ("+numtostr(High1D,4)+")");

Text_SetStyle (prev1DHighText, 0, 1);

TEXT_SETCOLOR(prev1DHighText, middleYesterdayTLColor);

end;

 

if (prev1DLowTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev1DLowTrendLine, JulianToDate(DateToJulian(Date[numOfPrev1Days])), SessionStartTime(1,SessionNum), Low1D)

else

TL_SetBegin(prev1DLowTrendLine, JulianToDate(DateToJulian(Date)-numOfDays), SessionStartTime(1,SessionNum), Low1D);

TL_SetEnd(prev1DLowTrendLine, Date, Time+2, Low1D);

end else begin

if (bartype = 2) then

prev1DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev1Days])), SessionStartTime(1, SessionNum) , Low1D, DATE, time+2, Low1D)

else

prev1DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays), SessionStartTime(1, SessionNum) , Low1D, DATE, time+2, Low1D);

 

TL_SetColor(prev1DLowTrendLine, middleYesterdayTLColor);

TL_SetStyle(prev1DLowTrendLine, 4);

end;

if (prev1DLowText > 0) then

Text_SetLocation (prev1DLowText, date, time+2 ,Low1D)

else begin

prev1DLowText = Text_New(DATE, TIME+2 , Low1D, " 1 Day Low ("+numtostr(Low1D,4)+")");

Text_SetStyle (prev1DLowText, 0, 1);

TEXT_SETCOLOR(prev1DLowText, middleYesterdayTLColor);

end;

 

 

if (middle1DTL > 0) then begin

if (bartype = 2) then

TL_SetBegin(middle1DTL, JulianToDate(DateToJulian(Date[numOfPrev1Days])), SessionStartTime(1,SessionNum), middle1D)

else

TL_SetBegin(middle1DTL, JulianToDate(DateToJulian(Date)-numOfDays), SessionStartTime(1,SessionNum), middle1D);

TL_SetEnd(middle1DTL, Date, Time+2, middle1D);

end else begin

if (bartype = 2) then

middle1DTL= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev1Days])), SessionStartTime(1,SessionNum) , middle1D, DATE, time+2, middle1D)

else

middle1DTL= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays), SessionStartTime(1,SessionNum) , middle1D, DATE, time+2, middle1D);

TL_SETSIZE(middle1DTL, 2);

TL_SetColor(middle1DTL, middleYesterdayTLColor);

end;

if (middle1DText > 0) then

Text_SetLocation (middle1DText, date, time+2 ,middle1D)

else begin

middle1DText = Text_New(DATE, TIME+2 , middle1D, " 1 Day BPOINT ("+numtostr(middle1D,4)+")");

Text_SetStyle (middle1DText, 0, 1);

TEXT_SETCOLOR(middle1DText, middleYesterdayTLColor);

end;

end;

 

//4 days

if (Use4Day) then begin

High4D = MaxList(HighD(1), HighD(2), HighD(3), HighD(4));

Low4D = MinList(LowD(1), LowD(2),LowD(3), LowD(4));

if (DayOfWeek(currentDate) = 6 or DayOfWeek(currentDate) = 0) then begin

High4D = MaxList(HighD(0), HighD(1), HighD(2), HighD(3));

Low4D = MinList(LowD(0), LowD(1), LowD(2), LowD(3));

end else if((DayOfWeek(currentDate) = 1 or DayOfWeek(currentDate) =2 or DayOfWeek(currentDate) = 3 or DayOfWeek(currentDate) = 4)

and (bartype<>2 and isGlobex=false)) then begin

High4D = MaxList(HighD(1),HighD(2), HighD(3), HighD(4), HighD(5));

Low4D = MinList(LowD(1),LowD(2), LowD(3),LowD(4), LowD(5));

end;

middle4D = Low4D+(High4D-Low4D)/2;

tempdaysback = numOfDays+3;

if (dayofweek(date) = 4 or dayofweek(date) = 3 or dayofweek(date) = 2) then begin

if (isGlobex=false) then

tempdaysback = 7

else

tempdaysback = 6;

end else if (dayofweek(date) = 5) then begin

if (isGlobex=false) then

tempdaysback = 5

else

tempdaysback = 4;

if (SessionEndTime(1,5) = time) then

tempdaysback = tempdaysback-1;

end;

if (prev4DHighTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev4DHighTrendLine, JulianToDate(DateToJulian(Date[numOfPrev4Days])), SessionStartTime(1,SessionNum), High4D)

else

TL_SetBegin(prev4DHighTrendLine, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), High4D);

 

TL_SetEnd(prev4DHighTrendLine, Date, Time+2, High4D);

end else begin

if (bartype = 2) then

prev4DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev4Days])), SessionStartTime(1,SessionNum) , High4D, DATE, time+2 , High4D)

else

prev4DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , High4D, DATE, time+2 , High4D);

 

TL_SetColor(prev4DHighTrendLine, middle4dTLColor);

TL_SetStyle(prev4DHighTrendLine, 4);

end;

if (prev4DHighText > 0) then

Text_SetLocation (prev4DHighText, date, time+2 ,High4D)

else begin

prev4DHighText = Text_New(DATE, TIME+2 , High4D, " 4 Day High ("+numtostr(High4D,4)+")");

Text_SetStyle (prev4DHighText, 0, 2);

TEXT_SETCOLOR(prev4DHighText, middle4dTLColor);

end;

 

if (prev4DLowTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev4DLowTrendLine, JulianToDate(DateToJulian(Date[numOfPrev4Days])), SessionStartTime(1,SessionNum), Low4D)

else

TL_SetBegin(prev4DLowTrendLine, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), Low4D);

TL_SetEnd(prev4DLowTrendLine, Date, Time+2, Low4D);

end else begin

if (bartype = 2) then

prev4DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev4Days])), SessionStartTime(1, SessionNum) , Low4D, DATE, time+2, Low4D)

else

prev4DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1, SessionNum) , Low4D, DATE, time+2, Low4D);

 

TL_SetColor(prev4DLowTrendLine, middle4dTLColor);

TL_SetStyle(prev4DLowTrendLine, 4);

end;

if (prev4DLowText > 0) then

Text_SetLocation (prev4DLowText, date, time+2 ,Low4D)

else begin

prev4DLowText = Text_New(DATE, TIME+2 , Low4D, " 4 Day Low ("+numtostr(Low4D,4)+")");

Text_SetStyle (prev4DLowText, 0, 2);

TEXT_SETCOLOR(prev4DLowText, middle4dTLColor);

end;

 

 

if (middle4DTL > 0) then begin

if (bartype = 2) then

TL_SetBegin(middle4DTL, JulianToDate(DateToJulian(Date[numOfPrev4Days])), SessionStartTime(1,SessionNum), middle4D)

else

TL_SetBegin(middle4DTL, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), middle4D);

 

TL_SetEnd(middle4DTL, Date, Time+2, middle4D);

end else begin

if (bartype = 2) then

middle4DTL= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev4Days])), SessionStartTime(1,SessionNum) , middle4D, DATE, time+2, middle4D)

else

middle4DTL= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , middle4D, DATE, time+2, middle4D);

TL_SETSIZE(middle4DTL, 2);

TL_SetColor(middle4DTL, middle4dTLColor);

end;

if (middle4DText > 0) then

Text_SetLocation (middle4DText, date, time+2 ,middle4D)

else begin

middle4DText = Text_New(DATE, TIME+2 , middle4D, " 4 Day BPOINT ("+numtostr(middle4D,4)+")");

Text_SetStyle (middle4DText, 0, 2);

TEXT_SETCOLOR(middle4DText, middle4dTLColor);

end;

end;

 

//5 days

if (Use5Day) then begin

High5D = MaxList(HighD(1), HighD(2), HighD(3), HighD(4), HighD(5));

Low5D = MinList(LowD(1), LowD(2),LowD(3), LowD(4), LowD(5));

if (DayOfWeek(currentDate) = 6 or DayOfWeek(currentDate) = 0) then begin

High5D = MaxList(HighD(0), HighD(1), HighD(2), HighD(3), HighD(4));

Low5D = MinList(LowD(0), LowD(1), LowD(2), LowD(3), LowD(4));

end else if(DayOfWeek(currentDate) = 1 or DayOfWeek(currentDate) = 2 or DayOfWeek(currentDate) = 3 or DayOfWeek(currentDate) = 4)

and (bartype<>2 and isGlobex=false) then begin

High5D = MaxList(HighD(1),HighD(2), HighD(3), HighD(4), HighD(5), HighD(6));

Low5D = MinList(LowD(1), LowD(2), LowD(3),LowD(4), LowD(5), LowD(6));

end;

middle5D = Low5D+(High5D-Low5D)/2;

tempdaysback = numOfDays+4;

if (dayofweek(date) = 4 or dayofweek(date) = 5 or dayofweek(date) = 3 or dayofweek(date) = 2) then

if (isGlobex=false) then

tempdaysback = 8

else

tempdaysback = 7;

 

if (prev5DHighTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev5DHighTrendLine, JulianToDate(DateToJulian(Date[numOfPrev5Days+1])), SessionStartTime(1,SessionNum), High5D)

else begin

if (dayofweek(date) = 5) then

TL_SetBegin(prev5DHighTrendLine, JulianToDate(DateToJulian(Date)-numOfDays-6), SessionStartTime(1,SessionNum), High5D)

else

TL_SetBegin(prev5DHighTrendLine, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), High5D);

end;

TL_SetEnd(prev5DHighTrendLine, Date, Time+2, High5D);

end else begin

if (bartype = 2) then

prev5DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev5Days])), SessionStartTime(1,SessionNum) , High5D, DATE, time+2 , High5D)

else

if (dayofweek(date) = 5) then

prev5DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays-6), SessionStartTime(1,SessionNum) , High5D, DATE, time+2 , High5D)

else

prev5DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , High5D, DATE, time+2 , High5D);

 

TL_SetColor(prev5DHighTrendLine, middle5dTLColor);

TL_SetStyle(prev5DHighTrendLine, 4);

end;

if (prev5DHighText > 0) then

Text_SetLocation (prev5DHighText, date, time+2 ,High5D)

else begin

prev5DHighText = Text_New(DATE, TIME+2 , High5D, " 5 Day High ("+numtostr(High5D,4)+")");

Text_SetStyle (prev5DHighText, 0, 0);

TEXT_SETCOLOR(prev5DHighText, middle5dTLColor);

end;

 

if (prev5DLowTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev5DLowTrendLine, JulianToDate(DateToJulian(Date[numOfPrev5Days])), SessionStartTime(1,SessionNum), Low5D)

else

if (dayofweek(date) = 5) then

TL_SetBegin(prev5DLowTrendLine, JulianToDate(DateToJulian(Date)-numOfDays-6), SessionStartTime(1,SessionNum), Low5D)

else

TL_SetBegin(prev5DLowTrendLine, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), Low5D);

TL_SetEnd(prev5DLowTrendLine, Date, Time+2, Low5D);

end else begin

if (bartype = 2) then

prev5DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev5Days])), SessionStartTime(1, SessionNum) , Low5D, DATE, time+2, Low5D)

else

if (dayofweek(date) = 5) then

prev5DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays-6), SessionStartTime(1, SessionNum) , Low5D, DATE, time+2, Low5D)

else

prev5DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1, SessionNum) , Low5D, DATE, time+2, Low5D);

 

TL_SetColor(prev5DLowTrendLine, middle5dTLColor);

TL_SetStyle(prev5DLowTrendLine, 4);

end;

if (prev5DLowText > 0) then

Text_SetLocation (prev5DLowText, date, time+2 ,Low5D)

else begin

prev5DLowText = Text_New(DATE, TIME+2 , Low5D, " 5 Day Low ("+numtostr(Low5D,4)+")");

Text_SetStyle (prev5DLowText, 0, 0);

TEXT_SETCOLOR(prev5DLowText, middle5dTLColor);

end;

 

 

if (middle5DTL > 0) then begin

if (bartype = 2) then

TL_SetBegin(middle5DTL, JulianToDate(DateToJulian(Date[numOfPrev5Days])), SessionStartTime(1,SessionNum), middle5D)

else

if (dayofweek(date) = 5) then

TL_SetBegin(middle5DTL, JulianToDate(DateToJulian(Date)-numOfDays-6), SessionStartTime(1,SessionNum), middle5D)

else

TL_SetBegin(middle5DTL, JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum), middle5D);

 

TL_SetEnd(middle5DTL, Date, Time+2, middle5D);

end else begin

if (bartype = 2) then

middle5DTL= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev5Days])), SessionStartTime(1,SessionNum) , middle5D, DATE, time+2, middle5D)

else

if (dayofweek(date) = 5) then

middle5DTL= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays-6), SessionStartTime(1,SessionNum) , middle5D, DATE, time+2, middle5D)

else

middle5DTL= TL_NEW(JulianToDate(DateToJulian(Date)-tempdaysback), SessionStartTime(1,SessionNum) , middle5D, DATE, time+2, middle5D);

TL_SETSIZE(middle5DTL, 2);

TL_SetColor(middle5DTL, middle5dTLColor);

end;

if (middle5DText > 0) then

Text_SetLocation (middle5DText, date, time+2 ,middle5D)

else begin

middle5DText = Text_New(DATE, TIME+2 , middle5D, " 5 Day BPOINT ("+numtostr(middle5D,4)+")");

Text_SetStyle (middle5DText, 0, 0);

TEXT_SETCOLOR(middle5DText, middle5dTLColor);

end;

end;

 

//10 days

if (Use10Day) then begin

High10D = MaxList(HighD(1), HighD(2), HighD(3), HighD(4), HighD(5), HighD(6), HighD(7), HighD(8), HighD(9), HighD(10));

Low10D = MinList(LowD(1), LowD(2),LowD(3), LowD(4), LowD(5), LowD(6), LowD(7),LowD(8), LowD(9), LowD(10));

if (DayOfWeek(currentDate) = 6 or DayOfWeek(currentDate) = 0) then begin

High10D = MaxList(HighD(0),HighD(1), HighD(2), HighD(3), HighD(4), HighD(5), HighD(6), HighD(7), HighD(8), HighD(9));

Low10D = MinList(LowD(0), LowD(1), LowD(2),LowD(3), LowD(4), LowD(5), LowD(6), LowD(7),LowD(8), LowD(9));

end else if((bartype<>2 and isGlobex=false)) then begin

High10D = MaxList(HighD(1), HighD(2), HighD(3), HighD(4), HighD(5), HighD(6),HighD(7), HighD(8), HighD(9), HighD(10), HighD(11), HighD(12));

Low10D = MinList(HighD(1), LowD(2), LowD(3),LowD(4), LowD(5), LowD(6),LowD(7), LowD(8),LowD(9), LowD(10), LowD(11), LowD(12));

end;

middle10D = Low10D+(High10D-Low10D)/2;

 

numOfDays = numOfDays+2;

 

if (prev10DHighTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev10DHighTrendLine, JulianToDate(DateToJulian(Date[numOfPrev10Days])), SessionStartTime(1,SessionNum), High10D)

else

TL_SetBegin(prev10DHighTrendLine, JulianToDate(DateToJulian(Date)-numOfDays-11), SessionStartTime(1,SessionNum), High10D);

 

TL_SetEnd(prev10DHighTrendLine, Date, Time+2, High10D);

end else begin

if (bartype = 2) then

prev10DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev10Days])), SessionStartTime(1,SessionNum) , High10D, DATE, time+2 , High10D)

else

prev10DHighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays-11), SessionStartTime(1,SessionNum) , High10D, DATE, time+2 , High10D);

 

TL_SetColor(prev10DHighTrendLine, middle10dTLColor);

TL_SetStyle(prev10DHighTrendLine, 4);

end;

if (prev10DHighText > 0) then

Text_SetLocation (prev10DHighText, date, time+2 ,High10D)

else begin

prev10DHighText = Text_New(DATE, TIME+2 , High10D, " 10 Day High ("+numtostr(High10D,4)+")");

Text_SetStyle (prev10DHighText, 0, 1);

TEXT_SETCOLOR(prev10DHighText, middle10dTLColor);

end;

 

if (prev10DLowTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(prev10DLowTrendLine, JulianToDate(DateToJulian(Date[numOfPrev10Days])), SessionStartTime(1,SessionNum), Low10D)

else

TL_SetBegin(prev10DLowTrendLine, JulianToDate(DateToJulian(Date)-numOfDays-11), SessionStartTime(1,SessionNum), Low10D);

TL_SetEnd(prev10DLowTrendLine, Date, Time+2, Low10D);

end else begin

if (bartype = 2) then

prev10DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev10Days])), SessionStartTime(1, SessionNum) , Low10D, DATE, time+2, Low10D)

else

prev10DLowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays-11), SessionStartTime(1, SessionNum) , Low10D, DATE, time+2, Low10D);

 

TL_SetColor(prev10DLowTrendLine, middle10dTLColor);

TL_SetStyle(prev10DLowTrendLine, 4);

end;

if (prev10DLowText > 0) then

Text_SetLocation (prev10DLowText, date, time+2 ,Low10D)

else begin

prev10DLowText = Text_New(DATE, TIME+2 , Low10D, " 10 Day Low ("+numtostr(Low10D,4)+")");

Text_SetStyle (prev10DLowText, 0, 1);

TEXT_SETCOLOR(prev10DLowText, middle10dTLColor);

end;

 

 

if (middle10DTL > 0) then begin

if (bartype = 2) then

TL_SetBegin(middle10DTL, JulianToDate(DateToJulian(Date[numOfPrev10Days])), SessionStartTime(1,SessionNum), middle10D)

else

TL_SetBegin(middle10DTL, JulianToDate(DateToJulian(Date)-numOfDays-11), SessionStartTime(1,SessionNum), middle10D);

 

TL_SetEnd(middle10DTL, Date, Time+2, middle10D);

end else begin

if (bartype = 2) then

middle10DTL= TL_NEW(JulianToDate(DateToJulian(Date[numOfPrev10Days])), SessionStartTime(1,SessionNum) , middle10D, DATE, time+2, middle10D)

else

middle10DTL= TL_NEW(JulianToDate(DateToJulian(Date)-numOfDays-11), SessionStartTime(1,SessionNum) , middle10D, DATE, time+2, middle10D);

TL_SETSIZE(middle10DTL, 2);

TL_SetColor(middle10DTL, middle10dTLColor);

end;

if (middle10DText > 0) then

Text_SetLocation (middle10DText, date, time+2 ,middle10D)

else begin

middle10DText = Text_New(DATE, TIME+2 , middle10D, " 10 Day BPOINT ("+numtostr(middle10D,4)+")");

Text_SetStyle (middle10DText, 0, 1);

TEXT_SETCOLOR(middle10DText, middle10dTLColor);

end;

end;

 

 

if (isGlobex = false) then begin

if (DayOfWeek(date) = 6 or DayOfWeek(date)=0) then

SessionNum = 1

else

SessionNum = DayOfWeek(date);

if (HighTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(HighTrendLine, JulianToDate(DateToJulian(Date[1])), SessionStartTime(1,SessionNum), HighD(0))

else

TL_SetBegin(HighTrendLine, JulianToDate(DateToJulian(Date)-1), SessionStartTime(1,SessionNum), HighD(0));

 

TL_SetEnd(HighTrendLine, Date, Time+2, HighD(0));

end else begin

if (bartype = 2) then

HighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[1])), SessionStartTime(1,SessionNum) , HighD(0), DATE, time+2 , HighD(0))

else

HighTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-1), SessionStartTime(1,SessionNum) , HighD(0), DATE, time+2 , HighD(0));

 

TL_SetColor(HighTrendLine, White);

TL_SETSIZE(HighTrendLine, 2);

end;

if (HighText > 0) then begin

Text_SetLocation (HighText, date, time+2 , HighD(0));

Text_SetString (HighText, numtostr(HighD(0),4));

end else begin

HighText = Text_New(DATE, TIME+2 , HighD(0), " Today Globex High ("+numtostr( HighD(0),4)+")");

Text_SetStyle (HighText, 0, 2);

TEXT_SETCOLOR(HighText, White);

end;

if (LowTrendLine > 0) then begin

if (bartype = 2) then

TL_SetBegin(LowTrendLine, JulianToDate(DateToJulian(Date[1])), SessionStartTime(1,SessionNum), LowD(0))

else

TL_SetBegin(LowTrendLine, JulianToDate(DateToJulian(Date)-1), SessionStartTime(1,SessionNum), LowD(0));

 

TL_SetEnd(LowTrendLine, Date, Time+2, LowD(0));

end else begin

if (bartype = 2) then

LowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date[1])), SessionStartTime(1,SessionNum) , LowD(0), DATE, time+2 , LowD(0))

else

LowTrendLine= TL_NEW(JulianToDate(DateToJulian(Date)-1), SessionStartTime(1,SessionNum) , LowD(0), DATE, time+2 , LowD(0));

 

TL_SetColor(LowTrendLine, White);

TL_SETSIZE(LowTrendLine, 2);

end;

if (LowText > 0) then begin

Text_SetLocation (LowText, date, time+2 ,LowD(0));

Text_SetString (LowText, numtostr(LowD(0),4));

end else begin

LowText = Text_New(DATE, TIME+2 , LowD(0), " Today Globex Low ("+numtostr( LowD(0),4)+")");

Text_SetStyle (LowText, 0, 2);

TEXT_SETCOLOR(LowText, White);

end;

end;

end;

Share this post


Link to post
Share on other sites
Hi Guys,

 

Code for TS/MC.

Trading purpose : Very strong sup/res analysis.

 

 

New here so I wanted to contribute some of my coding and ideas.

 

Having read Bryce Gylmore journals, I coded his Balance point idea.

This is my personal coding so no copyright issues will come up.

 

Hope this helps.

 

The code:...

 

 

 

this looks very nice.

 

Thank you.

Share this post


Link to post
Share on other sites

You are welcome guys.

Sorry for pasting the code into the thread. Moderator please fix this.

 

PS - As you can see I actually enhanced the code, because Gylmore's idea is only for a 3 day balance point which is less than sufficient....So I added some points.

As with reversals take caution and use reversal approaches, to elliminate false moves.

I would seek confluence of major pivots with this .

Share this post


Link to post
Share on other sites
Hi, could you please post this as an eld or txt format with a screenshot in the indicator forum? I would like other members to be able to find this as the coding forum is meant for coding request and help. Would appreciate it. Thanks.

 

James,

I have tried to post it there but I get a repeated warning and no option to post a new thread.

You have some bug in website, or I dont have enough security to post in the indicators section???

Share this post


Link to post
Share on other sites

Hi programmer, that is just a 10 second warning system. I implemented the warning message because many members were posting requests in that forum. The bar to proceed should popup in ten seconds after you hit new thread. Could you give it a try?

 

PS: please remember to post a screenshot attached to the forum system. Otherwise your indicator will not appear on the homepage. Thanks!

Share this post


Link to post
Share on other sites
Hi programmer, that is just a 10 second warning system. I implemented the warning message because many members were posting requests in that forum. The bar to proceed should popup in ten seconds after you hit new thread. Could you give it a try?

 

PS: please remember to post a screenshot attached to the forum system. Otherwise your indicator will not appear on the homepage. Thanks!

 

Ji James,

 

I have tried yet again and I get a loop of the warning again and again?????

Please do it for me, under my alias if you wish.

Share this post


Link to post
Share on other sites

Very interesting programmer.

 

Would you be able to give a brief update on how you find these useful in your own trading. I noticed that some of the balance point pivots (like the "Today" white pivot lines are hard coded with solid lines, and others you allow an input for toggling and/or dashed lines. Is this because you have found some balance points are typically not as stong as others?

 

Do you also find that an "untouched" balance point typically serves as stronger S/R similar to virgin POC's? Your insight is appreciated.

 

Thanks for the post... it is obvious that you spent some time on the code.

 

Snowbird

Share this post


Link to post
Share on other sites
Very interesting programmer.

 

Would you be able to give a brief update on how you find these useful in your own trading. I noticed that some of the balance point pivots (like the "Today" white pivot lines are hard coded with solid lines, and others you allow an input for toggling and/or dashed lines. Is this because you have found some balance points are typically not as stong as others?

 

Do you also find that an "untouched" balance point typically serves as stronger S/R similar to virgin POC's? Your insight is appreciated.

 

Thanks for the post... it is obvious that you spent some time on the code.

 

Snowbird

 

Hi Snowbird,

 

Bryce looks to the 3 day balance point as a mid level for market sentiment.

So, put it on SPY and DJIA to get a feel where the market is possibly going.

As for my own usage, I look for confluence on versatile points thus, when we had a volumetric day - in my experience it will serve as possible s/r levels for several days up to 10 since big players are positioned there, hence why I use 10 days on off.

 

No need to use Wavetrader its mostly predictive software, which is not the way to go....However, looking at the s/r levels in conjunction with other confluenctial points is quite high probability trading.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • ELV Elevance Health stock, watch for an upside gap breakout at https://stockconsultant.com/?ELV
    • ORLY OReilly Automotive stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?ORLY
    • Date: 28th March 2025.   Market Selloff Deepens as Tariff Concerns Weigh on Investors     Global stock markets extended their losing streak for a third day as concerns over looming US tariffs and an escalating trade war dampened investor sentiment. The flight to safety saw gold prices surge to a record high, underscoring growing risk aversion. Stock Selloff Intensifies The MSCI World Index recorded its longest losing streak in a month, while Asian equities saw their sharpest decline since late February. US and European stock futures also signalled potential weakness, while cryptocurrency markets retreated and bond yields edged lower. Investors are scaling back their exposure ahead of President Donald Trump’s expected announcement of ‘reciprocal tariffs’ on April 2. His latest move to impose a 25% levy on all foreign-made automobiles has sparked fresh concerns over inflation and economic growth, prompting traders to reassess their strategies. Investor Strategies Shift Market experts are adjusting their portfolios in anticipation of heightened volatility. ‘It’s impossible to predict Trump’s next move,’ said Xin-Yao Ng of Aberdeen Investments. ‘Our focus is on companies that are less vulnerable to tariff policies while taking advantage of market dips to find value opportunities.’ Yield Curve Signals Economic Concerns In the bond market, the spread between 30-year and 5-year US Treasury yields widened to its highest level since early 2022. Investors are bracing for potential Federal Reserve rate cuts if economic growth slows further. Long-term Treasury yields hit a one-month peak as inflation risks tied to tariffs spurred demand for higher-yielding assets. Boston Fed President Susan Collins noted that while tariffs may contribute to short-term price increases, their long-term effects remain uncertain. Gold Hits Record High as Safe-Haven Demand Rises Amid market turbulence, gold prices soared 0.7% on Friday, reaching an all-time high of $3,077.60 per ounce. Major banks have raised their price targets for the precious metal, with Goldman Sachs now forecasting gold to hit $3,300 per ounce by year-end. Looking Ahead As investors digest economic data showing US growth acceleration in Q4, attention will turn to Friday’s release of the personal consumption expenditures (PCE) price index—the Federal Reserve’s preferred inflation measure. This data will be critical in shaping expectations for future Fed policy moves. With markets on edge and trade tensions escalating, investors will closely monitor upcoming developments, particularly Trump’s tariff announcement next week, which could further dictate market direction.   Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news.   Andria Pichidi HFMarkets   Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in Leveraged Products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • Crypto hype is everywhere since it also making new riches as well, i however trade crypto little as compared to other forex trading pairs.
    • The ewallets can be instant withdrawals like skrill etc or they can also pay through crypto but not tested their crypto withdrawals so far.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.