Compare different stocks on different time frame
Author: leeto
Creation Date: 6/1/2015 7:30 AM
profile picture

leeto

#1
Could you help me to write a condition.

For example :

ABC on hour time frame

if( Bars.Close[bar] > Bars.Open[bar] )

and

CBA on daily time frame

if( Bars.Close[bar] > Bars.Open[bar] )

than

make some action
profile picture

Eugene

#2
There you are (run this on intraday chart of ABC):

CODE:
Please log in to see this code.


If you haven't yet reviewed the WealthScript Programming Guide (DataSeries > Accessing Secondary Symbols and Multi-Time Frame Analysis) and QuickRef tool (GetExternalSymbol, SetScale* etc.), it's perfect time.

Also, there are dozens of examples on the forums illustrating both external symbols and multi-time frame access.
profile picture

leeto

#3


Unfortunately, I couldnt reach needed article in wiki and wiki search don't help too.
(
http://www2.wealth-lab.com/WL5WIKI/kbSynchronizationOptions.ashx?HL=setscaledaily
See this article for further information: Synchronizing Daily Series in Intraday Timeframes
)
error 404




So could you tell me... So as far as I'm understand function
CODE:
Please log in to see this code.
set time frame on daily

could you tell me what function will set up time frame on 4 hours ; hour ; 30 minutes ; 15 minutes ; 5 minutes ?

Many thanks in advance
profile picture

Eugene

#4
QUOTE:
could you tell me what function will set up time frame on 4 hours ; hour ; 30 minutes ; 15 minutes ; 5 minutes ?

Hit F11 key to open QuickRef and see SetScaleCompressed.
profile picture

leeto

#5
QUOTE:
Hit F11 key to open QuickRef and see SetScaleCompressed.

Many thanks for reply.




Regarding the the code of a strategy from second reply.


This is probably my mistake because I again uncleanly express what I wanna to receive but "code" in reply#2 it don't work correctly for me.

The problem is that I would like to track daily changes of CBA simultaneously with ABC. However, it turn out that code shows CBA daily results only at the next market day ( when CBA candle is finished ) . In other words, I would like that action with ABC was made at the next minute when CBA turn from green candle ( close > open ) to red candle (open > close ). However, the code is written in the fashion that action with ABC will be made when CBA daily candle will be completed which is don't match with functionally that I would like to see.

Do you catch my idea ?
profile picture

Eugene

#6
Have you carefully reviewed the link you posted?

Compressed price series alignment
profile picture

leeto

#7
QUOTE:
Have you carefully reviewed the link you posted?

Compressed price series alignment



What I understand from the article is that before "Wealth lab 6" there was "Synchronization" dialog with 3 options of behavior. Now dialog is gone but idea is still valid and could be realize through the syntax that was provided in example. I run this example but I still think that example that enlighten the types of behaviors don't cover that I try to accomplish. I think so because lines that represent different behaviors are all horizontal lines but I need type of behaviors in which Y-coordinate of " behavior line " will be chance synchronously with underlying securities.

In other words If I look at the daily of the SPY and some stock at 5 minutes time frame. I would like to see that SPY daily will change every 5 minutes. So if SPY turn from green to red candle I will know (My algorithm will know ) that short position will be more preferable on the stock that Im watching.


profile picture

Eugene

#8
Then you'll have to build those OHLC bars manually which is very easy. Here's an example of how to get the OHLC of today:

CODE:
Please log in to see this code.
profile picture

leeto

#9
What is your code suppose to do ?

Unfortunately, when I run this code, it makes labels of the close last day ( from the 15 days ), open of the second day (from 15 days ) and high and low some another days. This is definitely not helps me at all. Unfortunately, once again.

Let's simplify more my question

When SPY crosses the low of the previous bar Hourly time frame

than

PEP open sell short (on 15 minute time frame )


However, I need that SPY on hour time frame should refreshing every minute and PEP on 15 minutes time frame should refreshing every minute. ..

Please help me. Many thx in advance !
profile picture

leeto

#10
I find out how to do this. If somebody interested in the code below will give answer. As always many thx everybody how tried to help !

CODE:
Please log in to see this code.
profile picture

Eugene

#11
QUOTE:
However, I need that SPY on hour time frame should refreshing every minute and PEP on 15 minutes time frame should refreshing every minute.

You don't need that because this is not how Wealth-Lab's strategy processing works. I'm sure that this FAQ should make it clear: Is it necessary to have access to intra-bar tick data to daytrade with Wealth-Lab?

So to tweak my code in post #2 as per your request from post #9, make this change and run it on 15-min chart of PEP:

CODE:
Please log in to see this code.


QUOTE:
Unfortunately, when I run this code, it makes labels of the close last day ( from the 15 days ), open of the second day (from 15 days ) and high and low some another days. This is definitely not helps me at all. Unfortunately, once again.

Sorry, there was an omission in my code but the rest is correct:

CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).