logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ericlawok  
#1 Posted : Monday, May 3, 2010 10:27:25 AM(UTC)
ericlawok

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/9/2008(UTC)
Posts: 7

Hi, I am looking for help with formula writing . I will present condition that I am looking for maybe someone could help that would be great. I working on polish futures market, I am looking for two currency pairs Euro/ Jen and Euro/Dollar I would like to see indicators that would show me decreasing or increasing in % form from previous period let’s say 10 minutes . And other that I can do in excel but it is time consuming : That would be: E/J ( % up or down) (+) E/USD ( % up or down ) ( any period D, W , 10 minutes ) Is it possible to see those two in one chart and with that indicators that shows increasing or decreasing on both combined together? Eric
ericlawok  
#2 Posted : Monday, May 3, 2010 11:17:38 AM(UTC)
ericlawok

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/9/2008(UTC)
Posts: 7

Security("_EUR_JPY",((C-O)/C)*100),C)+Security("_EUR_USD",((C-O)/C)*100),C) I wrote this one but it is not working I am making mistake somwere......can somone help with this?
mstt  
#3 Posted : Monday, May 3, 2010 5:35:38 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)

Hi Eric

I suggest that you take a slightly different approach when creating your indicator. I always include the full pathname when I use the security function. This means that the security called will be found even when I have a chart from a different folder open. Beware, though, because a tiny mistake in the pathname will cause the indicator to fail.

The second thing I suggest is to assign a variable name to each security call, as in the example below. This makes it much easier to check that each security call is working properly. In my example I can change the line that reads...

S1:=Security("C:\Equis\Stocks\World Indices\$DJ",C); {DJIA}

to

S1:=Security("C:\Equis\Stocks\World Indices\$DJ",C); {DJIA} S1;

This then plots the "S1" variable and tells me that either the expression works correctly or it doesn't work. This method of breaking a complex expression into simpler blocks usually makes finding a fault much easier. Once each building block (forex Security() call) has been check and is working correcly you can move on to creating and checking the main calculation.

Whatever calculations are included in the Security() function (outside " ") relate to prices or indicators from the called security, which is probably not the currently active chart.

My thinking is that a complex formula that's broken down into small and simple steps is easier to troubleshoot than a formula that's just one big unnamed variable. Hope this helps you solve your problem (do not try to make the indicator below plot unless the pathename for each security is changed first).

Roy

{Alpha Updated}
{Roy Larsen, 2009}

{User settings}
N:=Input("Alpha Updated, periods",1,100,21);
X:=Input("Index, 1=DJIA 2=US$ 3=FTSI 4=HS 5=SPX",1,5,1);

{Referenced index options}
S1:=Security("C:\Equis\Stocks\World Indices\$DJ",C); {DJIA}
S2:=Security("C:\Equis\Stocks\World Indices\$DX",C); {US Dollar}
S3:=Security("C:\Equis\Stocks\World Indices\$FT",C); {FTSI 100}
S4:=Security("C:\Equis\Stocks\World Indices\$HS",C); {Hang Seng}
S5:=Security("C:\Equis\Stocks\World Indices\$SP",C); {S&P 500}
I:=If(X=1,S1,If(X=2,S2,If(X=3,S3,If(X=4,S4,S5))));

{Beta}
P1:=N*Sum(ROC(C,1,%)*ROC(I,1,%),N);
P2:=Sum(ROC(C,1,%),N)*Sum(ROC(I,1,%),N);
P3:=N*Sum(Pwr(ROC(I,1,%),2),N)-
Pwr(Sum(ROC(I,1,%),N),2);
B:=(P1-P2)/(P3+(P3=0));

{Alpha}
(Sum(ROC(C,1,%),N)-B*Sum(ROC(I,1,%),N))/N;

ericlawok  
#4 Posted : Tuesday, May 4, 2010 8:27:54 AM(UTC)
ericlawok

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/9/2008(UTC)
Posts: 7

Hi Roy, Thank you very much I just look at this to be onest I have no idea how to go about it i will spend some time tonight maybe i can fifurate out something with your hepl. For now we are about to close market in poland and it`s so red....-4.35 on polsih futures market fwig20...men Anyway one more time thank you.
mstt  
#5 Posted : Tuesday, May 4, 2010 7:03:47 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)

H Eric

Maybe changing your formula to this one below will work. Lack of pathnames for the two currencies might still be a problem but shouldn't be if your active chart is from the same folder. Your percentage calculation seemed to have an extra and unwanted expression which I've removed. Placing "100" at the beginning of a percentage calculation allows one pair of brackets to be eliminated (useful when trying to economise on space for a much larger formula).

Security("_EUR_JPY",100*(C-O)/C) + Security("_EUR_USD",100*(C-O)/C);

Roy

ericlawok  
#6 Posted : Wednesday, May 5, 2010 11:37:05 AM(UTC)
ericlawok

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/9/2008(UTC)
Posts: 7

Hi Roy, That formula works great! Thank you... one more questions, I was traying to calculete previous day close or previous bar close Security("_EUR_JPY",100*(Ref(C,-1)-O)/(Ref(C,-1)) + Security("_EUR_USD",100*(Ref(C,-1)-O)/(Ref(C,-1)); It is not working can you look at that please So Close = Previous day close ( Eur_Jpy100*(Pprevius Day close - Open ) / Previous day close ) +....... I am traying to work with this and i used ref formula but probably that`s not the one. Thank you Is it posoble to have this smal formula working with e singnal data? I mean online? Thanks
ericlawok  
#7 Posted : Wednesday, May 5, 2010 12:51:37 PM(UTC)
ericlawok

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/9/2008(UTC)
Posts: 7

I try this one Security("_EUR_JPY",100*((Ref(C,-1))-O)/C) + Security("_EUR_USD",100*((Ref(C,-1))-O)/C); Not working..I am making mistake somwhere or I am.... Eric
ericlawok  
#8 Posted : Wednesday, May 5, 2010 12:54:37 PM(UTC)
ericlawok

Rank: Newbie

Groups: Registered, Registered Users
Joined: 4/9/2008(UTC)
Posts: 7

Security("_EUR_JPY",100*((Ref(C,-1))-O)/(Ref(C,-1))) + Security("_EUR_USD",100*((Ref(C,-1))-O)/(Ref(C,-1))); Roy I mean this one but .. Can you Help ? Eric
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.