How to plot data only for this week or month?

Questions about MultiCharts and user contributed studies.
User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

How to plot data only for this week or month?

Postby arnie » 10 May 2014

Hi.

If we only want to see our studies plotted today (good to remove to much "noise" from the chart) we may say

Code: Select all

if LastCalcDate = date then begin
value99 = (high + low) * .5;
plot1(value99);
end;


Is there any way (function) to do this by week and month?
Something like LastCalcWeek and LastCalcMonth?

Thanks

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: How to plot data only for this week or month?

Postby JoshM » 11 May 2014

Perhaps something like this:

Code: Select all

if (Month(Date) = MonthFromDateTime(ComputerDateTime)) then begin

// Month of bar is same month as computer DateTime month

end;

Code: Select all

if (WeekNumber(Date) = WeekNumber(JulianToDate(ComputerDateTime))) then begin

// Weeknumber of bar is same as the computer DateTime week number

end;
The WeekNumber function can be found here.

OZ Trade
Posts: 39
Joined: 08 Nov 2013
Has thanked: 11 times
Been thanked: 18 times

Re: How to plot data only for this week or month?

Postby OZ Trade » 14 May 2014

Can also plot in reverse from LastBarOnChart and break loop when a condition is encountered.. no computer date/time needed

Rough concept:

Code: Select all


Vars: LoopVar (0);

Inputs: Period (1);

If Period= 1 then
condition1= sessionlastbar
else if Period= 2 then
condition1= DayOfWeek(Date) < DayOfWeek(Date) [1]
else if Period= 3 then
condition1= Month(Date) <> Month(Date) [1];

If LastBarOnChart then For LoopVar= 0 to 3000 begin

Plot1 [LoopVar]((high[LoopVar] + low[LoopVar]) * .5);

If Condition1[LoopVar] then break;

End;
Needs to more code to plot the globex open correctly at the start of the month


Return to “MultiCharts”