Highest price for the first two days of the week  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
TomasD
Posts: 10
Joined: 04 Mar 2015
Location: Czech Republic, Central Europe
Has thanked: 3 times
Been thanked: 2 times

Highest price for the first two days of the week  [SOLVED]

Postby TomasD » 09 Dec 2015

Hi,
please can you help me?
I need a line for the highest price for the first two days of the week, which will end next Tuesday.
I drew what I think.


Thank you for your help
Attachments
Highest price.JPG
Line for the highest price for the first two days of the week
(144.39 KiB) Downloaded 662 times

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Highest price for the first two days of the week

Postby TJ » 09 Dec 2015

This is a start

HighD (Function)

The HighD series function allows you to reference the daily high of a previous day in an intraday chart (minute or tick-based) or a daily chart. HighD is one of a family of functions that allows historical references across various data intervals.

Syntax
HighD(PeriodsAgo)

Returns (Double)
The daily high price from a specified number of days ago. If the PeriodsAgo parameter is out of range (> 50), or there is not enough data, the function will return –1.

Sets the number of days/periods back to reference a previous day’s high price. (50 days back maximum) (0 = Today’s current high)

Remarks
You must have enough intraday data in the chart in order to look back and reference any previous daily high. For example, if you want to look back at the high of 25 days ago on a 5-minute chart, you must have at least 26 full days of 5-minute bars in the chart.

The value for the PeriodsAgo input parameter should always be a whole number greater than or equal to 0, but less than 51. Setting PeriodsAgo to 0 returns today’s current high.

Example
In order to place a short limit order at the High of the previous day you would write:

SellShort Next Bar at HighD(1) Limit;



See Also
LowD, CloseD, OpenD, HighW, HighM, and HighY.

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: Highest price for the first two days of the week

Postby bensat » 09 Dec 2015

Is there any rule about holidays on Mon or Tue and a switch to Wed to complete the '2 days' ?

User avatar
TomasD
Posts: 10
Joined: 04 Mar 2015
Location: Czech Republic, Central Europe
Has thanked: 3 times
Been thanked: 2 times

Re: Highest price for the first two days of the week

Postby TomasD » 10 Dec 2015

This is a start

HighD (Function)

The HighD series function allows you to reference the daily high of a previous day in an intraday chart (minute or tick-based) or a daily chart. HighD is one of a family of functions that allows historical references across various data intervals.

Syntax
HighD(PeriodsAgo)

Returns (Double)
The daily high price from a specified number of days ago. If the PeriodsAgo parameter is out of range (> 50), or there is not enough data, the function will return –1.

Sets the number of days/periods back to reference a previous day’s high price. (50 days back maximum) (0 = Today’s current high)

Remarks
You must have enough intraday data in the chart in order to look back and reference any previous daily high. For example, if you want to look back at the high of 25 days ago on a 5-minute chart, you must have at least 26 full days of 5-minute bars in the chart.

The value for the PeriodsAgo input parameter should always be a whole number greater than or equal to 0, but less than 51. Setting PeriodsAgo to 0 returns today’s current high.

Example
In order to place a short limit order at the High of the previous day you would write:

SellShort Next Bar at HighD(1) Limit;



See Also
LowD, CloseD, OpenD, HighW, HighM, and HighY.
Thanks for the advice TJ, it helped.
Here's the code to inspire others

Code: Select all

variable:
IBWhigh(0),
IBWlow(0),
IBWhighLine(0),
IBWlowLine(0),
IBWhighText(-1),
IBWlowText(0);

if
dayofweek(date)=3 then
begin

IBWhigh=maxlist(highd(1),HighD(2));
IBWlow=minlist(lowd(1),lowd(2));
end;


IBWhighLine=tl_new(d[1],t[1],IBWhigh,d,t,IBWhigh);
tl_setcolor(IBWhighLine,green);

IBWhighText=text_new(d,t,IBWhigh,numtostr(IBWhigh,4)+" IBW High");
Text_SetStyle(IBWhighText, 0, 1 ) ;
Text_SetColor(IBWhighText,RGB(151,129,0));


IBWlowLine=tl_new(d[1],t[1],IBWlow,d,t,IBWlow);
tl_setcolor(IBWlowLine,red);

IBWlowText=text_new(d,t,IBWlow,numtostr(IBWlow,4)+" IBW Low");
Text_SetStyle(IBWlowText, 0, 1 ) ;
Text_SetColor(IBWlowText,RGB(151,129,0));


if
IBWhighText<>IBWhighText[1] then
begin

text_delete(IBWhighText[1]);
text_delete(IBWlowText[1]);
end;
Attachments
Iinitial Balance Week.JPG
Result - Initial Balance Week
(162.43 KiB) Downloaded 668 times


Return to “MultiCharts”