Intraday indicator using daily ans weekly datas

Questions about MultiCharts and user contributed studies.
nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Intraday indicator using daily ans weekly datas

Postby nuno-online » 03 May 2011

Hi, is it possible to create an intraday indicator using daily and weekly data in order to use this one in an scanner.
Nuno

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 300 times

Re: Intraday indicator using daily ans weekly datas

Postby Stan Bokov » 03 May 2011

Dear Nuno,

Indicators that use data2, data3 and so on cannot be used in the Scanner.

nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Re: Intraday indicator using daily ans weekly datas

Postby nuno-online » 03 May 2011

Stan
is there another solution to monitor a list of stocks (using multiple time frame, without plotting the chart of each stock?

Nuno

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 03 May 2011

Can’t you recreate your indicator using OpenD, HighD, LowD, CloseD, OpenW, HighW, LowW, CloseW instead of data2 data series?

nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Re: Intraday indicator using daily ans weekly datas

Postby nuno-online » 03 May 2011

Good idea , i will see that

nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Re: Intraday indicator using daily ans weekly datas

Postby nuno-online » 06 May 2011

Hi

i recreate the indicator using CloseD (in order to use this one in an intraday scanner)
So, when i plot this one near the first indicator, i don't have the same result.

what is it wrong?
thank you
Attachments
THE INDICATOR I RECREATE.txt
(772 Bytes) Downloaded 39 times
THE INDICATOR 1.txt
(885 Bytes) Downloaded 39 times
CHART.png
CHART.png (118.72 KiB) Viewed 656 times

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 06 May 2011

You are using 2 different functions.
1.xAverage is calling itself as a series which does work with CloseD(0) //it needs number OR series but it uses only the number part of the series
2.Highest is calling Extremes which needs series to work with. You are giving him a number with CloseD(0) and NOT a series.

Just try this code as a simple example

function:

Code: Select all

inputs:
   PriceValue(numericseries);
_fTest = PriceValue[5] ;

indicator

Code: Select all

Plot1(_fTest(c));
Plot2(_fTest(CloseD(0)));


result
the Plot2 shows the price of today's close and Plot 1 the price of the close 5 days ago.

I bet you can find out for yourself how to advance from here :-)

EDIT 10:32 The simplest and easiest way to go from here is to write your own "_fHighestD" function which includes a loop.
Last edited by siscop on 06 May 2011, edited 1 time in total.

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 06 May 2011

Function
_fHighestD

Code: Select all

inputs:
   Len(numericsimple);
variables:
   var0(0);

var0=HighD(0);
for Value1 = 1 to Len - 1
begin
   if HighD(Value1)>var0 then
      var0=HighD(Value1);
end ;

_fHighestD=var0;

_fLowestD

Code: Select all

inputs:
   Len(numericsimple);
variables:
   var0(0);

var0=LowD(0);
for Value1 = 1 to Len - 1
begin
   if LowD(Value1)<var0 then
      var0=LowD(Value1);
end ;

_fLowestD=var0;

Indicator
_iTest2

Code: Select all

Inputs:
   Length1(10), Length2(5), Length3(5), UpColor(Green), DnColor(Red), AlertLevel(40);
   
Var:
   Day.HH(0), Day.LL(0), Day.SMI(0);

Day.HH = _fHighestD(Length1);
Day.LL = _fLowestD(Length1);

Day.SMI = 100 * (XAverage(XAverage(CloseD(0)-(0.5*(Day.HH+Day.LL)),Length2),Length3) / (0.5 * XAverage(XAverage(Day.HH-Day.LL,Length2),Length3)));

Plot1(Day.SMI, "Day.SMI" );
Plot2(AlertLevel, "Sell Line" );
Plot3(-AlertLevel, "Buy Line" );

If Day.SMI> Day.SMI[1] then
   begin
   Plot1[1](Day.SMI[1], "Day.SMI", Upcolor);
   Plot1(Day.SMI, "Day.SMI", Upcolor);
   end
   else begin
   Plot1[1](Day.SMI[1], "Day.SMI", Dncolor);
   Plot1(Day.SMI, "Day.SMI", Dncolor);
   end;


Just tested it and it works.
These users thanked the author siscop for the post:
TJ

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Intraday indicator using daily ans weekly datas

Postby TJ » 06 May 2011

siscop:

nice work!

thanks for sharing.

TJ

nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Re: Intraday indicator using daily ans weekly datas

Postby nuno-online » 06 May 2011

siscop
that 's great!!!

Thank you very much for your help

Nuno

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 06 May 2011

You're welcome

nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Re: Intraday indicator using daily ans weekly datas

Postby nuno-online » 06 May 2011

siscop

i tested the indicator in a daily chart and it's ok

But when i insert this indicator in an intraday chart, i don't have the same result.
Is it normal ?

Nuno

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 07 May 2011

you are right there is an error based on "XAverage" when I go intraday. I just changed the second function and it worked on the daychart but going to intraday the XAverage has to be changed as well.
I will work on it ASAP.

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 07 May 2011

First I have rewritten the CloseD data to arrays.
The problem I have is that there are more bars in intraday then on the series you want the function to calculate on and xAverage is not just calculating the last 10 bars with a Length of 10. It is depending on the last calculated bars. I rewrote the xAverage to depend alone on the data series entered and not on the number of bars but because of that it needs series as input now and the way your code is you are giving him again a number (Day.HH which is based on Highest – a number) and not a series.
First I have thought it should be easy coding that. Now I have changed all the functions and after that I will have to change the entire code itself.
I am sorry because of the follow-ups it takes more time then I wanted to spend on it.

If someone else want to give it a try - just go ahead.
These users thanked the author siscop for the post:
nuno-online

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Intraday indicator using daily ans weekly datas

Postby TJ » 07 May 2011

XAverage uses a short cut, it is like a FC, which does not work well in a function.

Try a plain Average, the result might be more satisfactory.

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 08 May 2011

xAverage is the EMA. The normal Average is the SMA so a total different indicator.
The shortcut you mentioned is necessary for the normal calculation of the EMA. However I have rewritten the EMA to sync up to the same result as the normal EMA but requests at least 3x Length data to be dependable to the series and not to the bar calling it from.
Since you need a series to calculate the new EMA we have to rewrite the other parameters to arrays and that is just the first step.
If anyone has another idea how to do this without changing everything in the code …. Just go ahead. I am willing to learn.

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Intraday indicator using daily ans weekly datas

Postby TJ » 08 May 2011

siscop wrote:xAverage is the EMA. The normal Average is the SMA so a total different indicator.
The shortcut you mentioned is necessary for the normal calculation of the EMA. However I have rewritten the EMA to sync up to the same result as the normal EMA but requests at least 3x Length data to be dependable to the series and not to the bar calling it from.
Since you need a series to calculate the new EMA we have to rewrite the other parameters to arrays and that is just the first step.
If anyone has another idea how to do this without changing everything in the code …. Just go ahead. I am willing to learn.


try this

XAverage.V by Bob Fulks
http://tradersxchange.com/viewtopic.php ... 9ce0104db9

This is a recoding of the XAverage function as a
"simple function" rather than as a "series function".
For correct results it must be evaluated on every bar, as is
normal for every simple functions.
These users thanked the author TJ for the post:
nuno-online

nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Re: Intraday indicator using daily ans weekly datas

Postby nuno-online » 08 May 2011

Siscop and TJ,
thank you for your help

I m reading yours posts and i 'm sorry but i don't see what is the problem with the Xaverage
We use the CloseD(0) in this line

Day.SMI = 100 * (XAverage(XAverage(CloseD(0)-(0.5*(Day.HH+Day.LL)),Length2),Length3) / (0.5 * XAverage(XAverage(Day.HH-Day.LL,Length2),Length3)));

Is there another way to scan a list of stocks in intraday once the daily and weekly setups are ok?


Nuno

nuno-online
Posts: 166
Joined: 31 Jan 2006
Has thanked: 72 times
Been thanked: 3 times

Re: Intraday indicator using daily ans weekly datas

Postby nuno-online » 08 May 2011

for example , is it possible (using ADE (All Data Everywhere)) to transfer the indicator information from a daily chart to a scanner with intraday resolution?

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Intraday indicator using daily ans weekly datas

Postby TJ » 22 May 2011

nuno-online wrote:Siscop and TJ,
thank you for your help

I m reading yours posts and i 'm sorry but i don't see what is the problem with the Xaverage
We use the CloseD(0) in this line

Day.SMI = 100 * (XAverage(XAverage(CloseD(0)-(0.5*(Day.HH+Day.LL)),Length2),Length3) / (0.5 * XAverage(XAverage(Day.HH-Day.LL,Length2),Length3)));

Is there another way to scan a list of stocks in intraday once the daily and weekly setups are ok?


Nuno


Why do you need to find another way? if you think there is no problem with xaverage... then why not use the method that works for you? Maybe I don't understand your intention, or the result you desired.

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 23 May 2011

Lets make it simple

Code: Select all

Inputs:
     Len(10);
Var:
   Indi(0),
      var0(0);
Array:
   OpenDtmp[110](0),
   HighDtmp[110](0),
   LowDtmp[110](0),
   CloseDtmp[110](0);

for var0=0 to 90
begin
   OpenDtmp[var0]=OpenD(var0);
   HighDtmp[var0]=HighD(var0);
   LowDtmp[var0]=LowD(var0);
   CloseDtmp[var0]=CloseD(var0);
end;

Indi=Average(CloseDtmp[0],Len);

Plot1(Indi);

The first part of the code puts CloseD to an array. The second part a normal SMA based on the Close of each day is calculated.
The normal SMA and my Indi have the same date when calculated on Timeframe D1.
It shouldn’t make a different when I base the SMA on D1 and my Indi on H1 (since his entry is based on CloseD from the code), but it does.
See screenshot.

My code is as simple as it gets but it doesnt work.
Anyone an idea?
Attachments
Indi.png
Indi.png (80.17 KiB) Viewed 646 times

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Intraday indicator using daily ans weekly datas

Postby TJ » 23 May 2011

siscop wrote:Lets make it simple

Code: Select all

Inputs:
     Len(10);
Var:
   Indi(0),
      var0(0);
Array:
   OpenDtmp[110](0),
   HighDtmp[110](0),
   LowDtmp[110](0),
   CloseDtmp[110](0);

for var0=0 to 90
begin
   OpenDtmp[var0]=OpenD(var0);
   HighDtmp[var0]=HighD(var0);
   LowDtmp[var0]=LowD(var0);
   CloseDtmp[var0]=CloseD(var0);
end;

Indi=Average(CloseDtmp[0],Len);

Plot1(Indi);

The first part of the code puts CloseD to an array. The second part a normal SMA based on the Close of each day is calculated.
The normal SMA and my Indi have the same date when calculated on Timeframe D1.
It shouldn’t make a different when I base the SMA on D1 and my Indi on H1 (since his entry is based on CloseD from the code), but it does.
See screenshot.

My code is as simple as it gets but it doesnt work.
Anyone an idea?


Saying "it doesnt work" tells me nothing.
You have to explicitly explain and point out what doesn't work. Where and what are the discrepancies you are looking at?

User avatar
siscop
Posts: 188
Joined: 09 Jan 2011
Has thanked: 33 times
Been thanked: 25 times

Re: Intraday indicator using daily ans weekly datas

Postby siscop » 23 May 2011

Well I thought that looking at the attached screenshot would explain it.
“MovAve Line1” is based on D1 Len=10
_Test3 is based on H1 Len=10 however it is coded that from CloseD so it shouldn’t matter on what the indicator base TF is since it should always take the CloseD = D1.
Looking at the screenshot you see that MovAveLine1 is NOT the same as _Test3.

When I put both indicator (MovAveLine1 and _Test3) on D1 both indicator have the same value. So what is wrong with the code that it doesn’t work when I put the indicator on H1? It should still show the Average from D1 but it doesn`t.

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: Intraday indicator using daily ans weekly datas

Postby TJ » 23 May 2011

siscop wrote:Well I thought that looking at the attached screenshot would explain it.
“MovAve Line1” is based on D1 Len=10
_Test3 is based on H1 Len=10 however it is coded that from CloseD so it shouldn’t matter on what the indicator base TF is since it should always take the CloseD = D1.
Looking at the screenshot you see that MovAveLine1 is NOT the same as _Test3.

When I put both indicator (MovAveLine1 and _Test3) on D1 both indicator have the same value. So what is wrong with the code that it doesn’t work when I put the indicator on H1? It should still show the Average from D1 but it doesn`t.


What are the values for a H1 chart:

1. in real time at 11 am, what is the value of CloseD(0)?

2. if you start the chart at the end of the day, what value do you see for CloseD(0) for 11 am?


Return to “MultiCharts”