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

    • Date: 25th November 2024. New Secretary Cheers Markets; Trump Trade Eased. Asia & European Sessions:   Equities and Treasuries rise, as markets view Donald Trump’s choice of Scott Bessent for Treasury Secretary as a stabilizing decision for the US economy and markets. Bessent: Head of macro hedge fund Key Square Group, supports Trump’s tax and tariff policies but gradually. He is expected to focus on economic and market stability rather than political gains. His nomination alleviates concerns over protectionist policies that could escalate inflation, trade tensions, and market volatility. Asian stocks rose, driven by gains in Japan, South Korea, and Australia. Chinese equities fail to follow regional trends, presenting investors’ continued disappointment by the lack of strong fiscal measures to boost the economy. The PBOC keeps policy loan rates unchanged after the September cut. US futures also see slight increases. 10-year Treasury yields fall by 5 basis points to 4.35%. Nvidia dropped 3.2%, affected by its high valuation and influence on broader market trends. Intuit fell 5.7% after a disappointing earnings forecast. Meta Platforms declined 0.7% following the Supreme Court’s decision to allow a class action lawsuit over the Cambridge Analytica scandal. Key events this week: Japan’s CPI, as the BOJ signals a possible policy change at December’s meeting. RBNZ expected to cut its key rate on Wednesday. CPI & GDP from Europe will be released. Traders will focus on the Fed’s November meeting minutes, along with consumer confidence and personal consumption expenditure data, to assess potential rate cuts next year. Financial Markets Performance: The US Dollar declines as US Treasuries climb. Bitcoin recovers from a weekend drop, hovering around 98,000, having more than doubled in value this year. Analysts suggest consolidation around the 100,000 level before any potential breakthrough. EURUSD recovers slightly to 1.0463 from 1.0320 lows. Oil prices drop after the largest weekly increase in nearly two months, with ongoing geopolitical risks in Ukraine and the Middle East. UKOIL fell below $75 a barrel, while USOILis at $70.35. Iran announced plans to boost its nuclear fuel-making capacity after being censured by the UN, increasing the potential for sanctions under Trump’s administration. Israel’s ambassador to the US indicated a potential cease-fire deal with Hezbollah, which could ease concerns about Middle Eastern oil production, a region supplying about a third of the world’s oil. Russia’s war in Ukraine escalated with longer-range missile use, raising concerns about potential disruptions to crude flows. Citigroup and JPMorgan predict that OPEC may delay a planned increase in production for the third time during their meeting this weekend. Gold falls to $2667.45 after its largest rise in 20 months last week.Swaps traders see a less-than-even chance the central bank will cut rates next month. Higher borrowing costs tend to weigh on gold, as it doesn’t pay interest. 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 FX and CFDs 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.
    • SNAP stock, big day off support at https://stockconsultant.com/?SNAP
    • SBUX Starbucks stock, nice breakout, from Stocks to Watch at https://stockconsultant.com/?SBUX
    • INTC Intel stock settling at 24.25 double support area at https://stockconsultant.com/?INTC
    • CORZ Core Scientific stock, strong close, watch for a top of range breakout above 18.32 at https://stockconsultant.com/?CORZ
×
×
  • Create New...

Important Information

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