move your prices forward study

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
arnie
Posts: 1589
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 478 times
Been thanked: 509 times

move your prices forward study

Postby arnie » 28 Aug 2016

Always hated having too many lines on my charts. They can create complete caos and mishmash readings.

When one don't have any interest in looking at historical prices and the main interest is having those historical prices only into today's session, one can plot all of them on the right edge of the chart.

Where's an example by plotting today's range as a rectangle and plotting today's open, yesterday's close, high and low as simple lines.

Image

Here's the code of this study

Code: Select all

Inputs:
   RightShift            (50);
   
Variables:
   CalcSession         (false),
   DailyHi         (-999999),
   DailyLo         (+999999),
   CurrentSess         (0),
   DailyOp         (0),
   DailyCl         (0),
   prevDayHi         (0),
   prevDayLo         (0),
   prevDayOp         (0),
   prevDayCl         (0);
      
CurrentSess = CurrentSession(0) ;

if CurrentSess <> CurrentSess[1] then begin      
   prevDayOp = DailyOp;
   prevDayCl = DailyCl;   
   DailyOp = Open;
      
   if DailyHi <> -999999 then
      prevDayHi = DailyHi;
   if DailyLo <> +999999 then
      prevDayLo = DailyLo;   
   DailyHi = -999999;
   DailyLo = +999999;            
end;
   
DailyCl = Close;
   
if High > DailyHi then
   DailyHi = High;
if Low < DailyLo then
   DailyLo = Low;   

for value1 = 0 to RightShift begin
   Plot1[-value1](DailyHi, "dayHi");
   Plot2[-value1](DailyLo, "dayLo");
   Plot3[-value1](prevDayHi, "prevDayHi");
   Plot4[-value1](prevDayLo, "prevDayLo");
   Plot5[-value1](DailyOp, "DayOpen");
   Plot6[-value1](prevDayCl, "prevDayCl");
end;


noplot(1);
noplot(2);
noplot(3);
noplot(4);
noplot(5);
noplot(6);


Keep note that the charts bar shift needs to be equal or lower than the RightShift study input because otherwise you'll receive an error.

Image

Here's the settings style
Image

Obviously this is way to simplistic and the idea is to build something more complex, mixing different time frames, allowing us to follow different ones in a more easy a simple way, without having lines on top of lines and on top of the price bars, creating that mishmash look.

Here is the initial idea.
Having the monthly, weekly and daily (RTH and ETH) high and low, shown as rectangles and then having simple lines showing previous day, week and month highs and lows.

Image

Here's this past Friday playback of how things look like.
You can see how this Friday ZN made a new week high and also a new week and month low, for me, in a very easy to read way.
http://www.screencast.com/t/Nti5OmCwN

Obviously that this would look better if we had transparencies and such but...
Attachments
rec04.png
rec04.png (9.5 KiB) Viewed 463 times
rec01.png
rec01.png (31.3 KiB) Viewed 461 times
rec03.png
rec03.png (23.34 KiB) Viewed 459 times
rec02.png
rec02.png (30.92 KiB) Viewed 464 times

User avatar
arnie
Posts: 1589
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 478 times
Been thanked: 509 times

Re: move your prices forward study

Postby arnie » 28 Aug 2016

We can also do manual references to prices and apply the same concept, plot it on the chart right edge and take it forward.

Image

Code: Select all

// 28/08/2016
// http://www.multicharts.com/discussion/viewtopic.php?f=5&t=50056

Inputs:
   RightShift            (50),
   LabelFont            ("consolas"),
   LabelSize            (7),
   LabelColor            (black),
   LabelSpace            (3),
   ShowPrice_1            (true),
   PriceLevel_1            (0), // price of reference
   Label_1            (" "), // write text to plot on the chart
   TickSize_1            (2), // heigth of price reference measured in ticks
   ShowPrice_2            (false),
   PriceLevel_2            (0),
   Label_2            (" "),
   TickSize_2            (2),
   ShowPrice_3            (false),
   PriceLevel_3            (0),
   Label_3            (" "),
   TickSize_3            (2),
   ShowPrice_4            (false),
   PriceLevel_4            (0),
   Label_4            (" "),
   TickSize_4            (2),
   ShowPrice_5            (false),
   PriceLevel_5            (0),
   Label_5            (" "),
   TickSize_5            (2),
   ShowPrice_6            (false),
   PriceLevel_6            (0),
   Label_6            (" "),
   TickSize_6            (2),
   ShowPrice_7            (false),
   PriceLevel_7            (0),
   Label_7            (" "),
   TickSize_7            (2),
   ShowPrice_8            (false),
   PriceLevel_8            (0),
   Label_8            (" "),
   TickSize_8            (2),
   ShowPrice_9            (false),
   PriceLevel_9            (0),
   Label_9            (" "),
   TickSize_9            (2),
   ShowPrice_10            (false),
   PriceLevel_10            (0),
   Label_10            (" "),
   TickSize_10            (2);


Variables:
   dTick               (MinMove/PriceScale),
   price1               (0),
   price1_            (0),
   _Label_1            (Label_1),
   price2               (0),
   price2_            (0),
   _Label_2            (Label_2),
   price3               (0),
   price3_            (0),
   _Label_3            (Label_3),
   price4               (0),
   price4_            (0),
   _Label_4            (Label_4),
   price5               (0),
   price5_            (0),
   _Label_5            (Label_5),
   price6               (0),
   price6_            (0),
   _Label_6            (Label_6),
   price7               (0),
   price7_            (0),
   _Label_7            (Label_7),
   price8               (0),
   price8_            (0),
   _Label_8            (Label_8),
   price9               (0),
   price9_            (0),
   _Label_9            (Label_9),
   price10            (0),
   price10_            (0),
   _Label_10            (Label_10),
   priceTXT_1            (-1),
   priceTXT_2            (-1),
   priceTXT_3            (-1),
   priceTXT_4            (-1),
   priceTXT_5            (-1),
   priceTXT_6            (-1),
   priceTXT_7            (-1),
   priceTXT_8            (-1),
   priceTXT_9            (-1),
   priceTXT_10            (-1);
   
once begin
   priceTXT_1 = Text_new_s(Date, Time_s, PriceLevel_1,"");            
      text_setfontname(priceTXT_1, LabelFont);
      text_setcolor(priceTXT_1, LabelColor);
      text_setsize(priceTXT_1, LabelSize);
      Text_SetStyle(priceTXT_1, 0, 2);
      text_lock(priceTXT_1, true);

   priceTXT_2 = Text_new_s(Date, Time_s, PriceLevel_2,"");            
      text_setfontname(priceTXT_2, LabelFont);
      text_setcolor(priceTXT_2, LabelColor);
      text_setsize(priceTXT_2, LabelSize);
      Text_SetStyle(priceTXT_2, 0, 2);
      text_lock(priceTXT_2, true);

   priceTXT_3 = Text_new_s(Date, Time_s, PriceLevel_3,"");            
      text_setfontname(priceTXT_3, LabelFont);
      text_setcolor(priceTXT_3, LabelColor);
      text_setsize(priceTXT_3, LabelSize);
      Text_SetStyle(priceTXT_3, 0, 2);
      text_lock(priceTXT_3, true);

   priceTXT_4 = Text_new_s(Date, Time_s, PriceLevel_4,"");            
      text_setfontname(priceTXT_4, LabelFont);
      text_setcolor(priceTXT_4, LabelColor);
      text_setsize(priceTXT_4, LabelSize);
      Text_SetStyle(priceTXT_4, 0, 2);
      text_lock(priceTXT_4, true);

   priceTXT_5 = Text_new_s(Date, Time_s, PriceLevel_5,"");            
      text_setfontname(priceTXT_5, LabelFont);
      text_setcolor(priceTXT_5, LabelColor);
      text_setsize(priceTXT_5, LabelSize);
      Text_SetStyle(priceTXT_5, 0, 2);
      text_lock(priceTXT_5, true);

   priceTXT_6 = Text_new_s(Date, Time_s, PriceLevel_6,"");            
      text_setfontname(priceTXT_6, LabelFont);
      text_setcolor(priceTXT_6, LabelColor);
      text_setsize(priceTXT_6, LabelSize);
      Text_SetStyle(priceTXT_6, 0, 2);
      text_lock(priceTXT_6, true);

   priceTXT_7 = Text_new_s(Date, Time_s, PriceLevel_7,"");            
      text_setfontname(priceTXT_7, LabelFont);
      text_setcolor(priceTXT_7, LabelColor);
      text_setsize(priceTXT_7, LabelSize);
      Text_SetStyle(priceTXT_7, 0, 2);
      text_lock(priceTXT_7, true);

   priceTXT_8 = Text_new_s(Date, Time_s, PriceLevel_8,"");            
      text_setfontname(priceTXT_8, LabelFont);
      text_setcolor(priceTXT_8, LabelColor);
      text_setsize(priceTXT_8, LabelSize);
      Text_SetStyle(priceTXT_8, 0, 2);
      text_lock(priceTXT_8, true);

   priceTXT_9 = Text_new_s(Date, Time_s, PriceLevel_9,"");            
      text_setfontname(priceTXT_9, LabelFont);
      text_setcolor(priceTXT_9, LabelColor);
      text_setsize(priceTXT_9, LabelSize);
      Text_SetStyle(priceTXT_9, 0, 2);
      text_lock(priceTXT_9, true);

   priceTXT_10 = Text_new_s(Date, Time_s, PriceLevel_10,"");            
      text_setfontname(priceTXT_10, LabelFont);
      text_setcolor(priceTXT_10, LabelColor);
      text_setsize(priceTXT_10, LabelSize);
      Text_SetStyle(priceTXT_10, 0, 2);
      text_lock(priceTXT_10, true);

end;

// ***** Price Level 1
if ShowPrice_1 = true then begin
   price1 = PriceLevel_1 + (TickSize_1 * dTick);
   price1_ = PriceLevel_1 - (TickSize_1 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot1[-value1](price1 , "price1");
      Plot2[-value1](price1_, "price1");
   end;

   text_setstring(priceTXT_1, spaces(LabelSpace) + " - " + text(_Label_1));
   Text_SetLocation_s(priceTXT_1, Date, Time_s, PriceLevel_1);
end;      

// ***** Price Level 2
if ShowPrice_2 = true then begin
   price2 = PriceLevel_2 + (TickSize_2 * dTick);
   price2_ = PriceLevel_2 - (TickSize_2 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot3[-value1](price2 , "price2");
      Plot4[-value1](price2_, "price2");
   end;

   text_setstring(priceTXT_2, spaces(LabelSpace) + " - " + text(_Label_2));
   Text_SetLocation_s(priceTXT_2, Date, Time_s, PriceLevel_2);   
end;

// ***** Price Level 3
if ShowPrice_3 = true then begin
   price3 = PriceLevel_3 + (TickSize_3 * dTick);
   price3_ = PriceLevel_3 - (TickSize_3 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot5[-value1](price3 , "price3");
      Plot6[-value1](price3_, "price3");
   end;

   text_setstring(priceTXT_3, spaces(LabelSpace) + " - " + text(_Label_3));
   Text_SetLocation_s(priceTXT_3, Date, Time_s, PriceLevel_3);
end;   

// ***** Price Level 4
if ShowPrice_4 = true then begin   
   price4 = PriceLevel_4 + (TickSize_4 * dTick);
   price4_ = PriceLevel_4 - (TickSize_4 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot7[-value1](price4 , "price4");
      Plot8[-value1](price4_, "price4");
   end;

   text_setstring(priceTXT_4, spaces(LabelSpace) + " - " + text(_Label_4));
   Text_SetLocation_s(priceTXT_4, Date, Time_s, PriceLevel_4);
end;

// ***** Price Level 5
if ShowPrice_5 = true then begin      
   price5 = PriceLevel_5 + (TickSize_5 * dTick);
   price5_ = PriceLevel_5 - (TickSize_5 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot9[-value1](price5 , "price5");
      Plot10[-value1](price5_, "price5");
   end;

   text_setstring(priceTXT_5, spaces(LabelSpace) + " - " + text(_Label_5));
   Text_SetLocation_s(priceTXT_5, Date, Time_s, PriceLevel_5);   
end;

// ***** Price Level 6
if ShowPrice_6 = true then begin   
   price6 = PriceLevel_6 + (TickSize_6 * dTick);
   price6_ = PriceLevel_6 - (TickSize_6 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot11[-value1](price6 , "price6");
      Plot12[-value1](price6_, "price6");
   end;

   text_setstring(priceTXT_6, spaces(LabelSpace) + " - " + text(_Label_6));
   Text_SetLocation_s(priceTXT_6, Date, Time_s, PriceLevel_6);   
end;

// ***** Price Level 7
if ShowPrice_7 = true then begin      
   price7 = PriceLevel_7 + (TickSize_7 * dTick);
   price7_ = PriceLevel_7 - (TickSize_7 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot13[-value1](price7 , "price7");
      Plot14[-value1](price7_, "price7");
   end;

   text_setstring(priceTXT_7, spaces(LabelSpace) + " - " + text(_Label_7));
   Text_SetLocation_s(priceTXT_7, Date, Time_s, PriceLevel_7);
end;

// ***** Price Level 8
if ShowPrice_8 = true then begin         
   price8 = PriceLevel_8 + (TickSize_8 * dTick);
   price8_ = PriceLevel_8 - (TickSize_8 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot15[-value1](price8 , "price8");
      Plot16[-value1](price8_, "price8");
   end;

   text_setstring(priceTXT_8, spaces(LabelSpace) + " - " + text(_Label_8));
   Text_SetLocation_s(priceTXT_8, Date, Time_s, PriceLevel_8);
end;

// ***** Price Level 9
if ShowPrice_9 = true then begin         
   price9 = PriceLevel_9 + (TickSize_9 * dTick);
   price9_ = PriceLevel_9 - (TickSize_9 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot17[-value1](price9 , "price9");
      Plot18[-value1](price9_, "price9");
   end;

   text_setstring(priceTXT_9, spaces(LabelSpace) + " - " + text(_Label_9));
   Text_SetLocation_s(priceTXT_9, Date, Time_s, PriceLevel_9);   
end;

// ***** Price Level 10
if ShowPrice_10 = true then begin      
   price10 = PriceLevel_10 + (TickSize_10 * dTick);
   price10_ = PriceLevel_10 - (TickSize_10 * dTick);
         
   for value1 = 0 to RightShift begin
      Plot19[-value1](price10 , "price10");
      Plot20[-value1](price10_, "price10");
   end;

   text_setstring(priceTXT_10, spaces(LabelSpace) + " - " + text(_Label_10));
   Text_SetLocation_s(priceTXT_10, Date, Time_s, PriceLevel_10);
end;      

noplot(1);
noplot(2);
noplot(3);
noplot(4);
noplot(5);
noplot(6);
noplot(7);
noplot(8);
noplot(9);
noplot(10);
Attachments
rec05.png
rec05.png (42.25 KiB) Viewed 466 times


Return to “User Contributed Studies and Indicator Library”