Rank: Member
Groups: Registered, Registered Users Joined: 11/10/2008(UTC) Posts: 22
|
Sorry if this is obvious, but I have tried and failed, so thought I would ask for some help...
I am trying to write an INTRA day formula (Meta 10 Pro) that uses as part of its calculation a piece of data from the End-of-Day for the same stock. How do I do this?
To be specific:
If I wanted to write a function that flags when the current Intraday price of a stock is above (or below) its Closing price from yesterday by xyz%, how would I do this? Everytime I try to "mix" references to data files with different periods in the same function I get an error back, and it refuses to continue.
Thanks!
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Hi Chestnut, The simple, but not very elegant and not very robust way to do this particular task is detect the intraday bar which starts the new day, then look at the close of the previous bar; something like: Code:
newDay:=dayofmonth()<>ref(dayofmonth(),-1) or month()<>ref(month(),-1) or year()<>ref(year(),-1);
prevClose:=valuewhen(1,newDay,ref(c,-1));
{plot}
prevClose;
Note: this code doesn't take into account effects at the left hand side of the chart, initialisation etc so use the concept, not the code. Perhaps a better way is to have a look at Roy Larsen's excellent coding work at his website: http://www.metastocktips.co.nz/
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 6/6/2008(UTC) Posts: 9
|
Try this
percentage:=Input("Percentage",1,10,3); percentage:=percentage/100;
dStart:=DayOfMonth()<>Ref(DayOfMonth(),-1) OR Cum(1)=2;
{ Previous Day's Close } Cd:=ValueWhen(1,dStart,ValueWhen(2,1,C));
If(C>CD*(percentage+1),1,If(C<CD*(1-percentage),-1,0));
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.