Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Quad, alibaba, rki), 425 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to: plot a frequency spectrum in bars? #483234
05/12/21 01:14
05/12/21 01:14
Joined: May 2021
Posts: 6
S
Sempervirens Offline OP
Newbie
Sempervirens  Offline OP
Newbie
S

Joined: May 2021
Posts: 6
Hi, I'm trying to figure out how to plot a frequency spectrum in bars. While reading TFH Build Better Strategies Part 3 and trying to follow along I got stuck real quick, on step #2 he plots a frequency spectrum of cycle amplitude vs cycle length in bars. I've tried doing something like this to replicate the result:

Code
function run()
{
  vars Price = series(price());
  var Phase = DominantPhase(Price,10);
  vars Dominant = series(rDominantPeriod);
  
  plotBar("Spectrum",Amplitude(Dominant, rDominantPeriod),Amplitude(Dominant, rDominantPeriod),rDominantPeriod,BARS|AVG,RED);
}

to no success. I just get " Error 047: No bars to plot" Any help would be much appreciated. Thanks in advance.

Re: How to: plot a frequency spectrum in bars? [Re: Sempervirens] #483235
05/12/21 01:46
05/12/21 01:46
Joined: Feb 2017
Posts: 1,724
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,724
Chicago
The manual is your friend! See the info on error code# 47:
Quote
Warning / Error 047: Not enough bars
Historical price data was invalid or insufficient for covering the test period or the LookBack period. In the latter case the script won't run. Possible reasons:
  • The selected asset did not exist. Check your asset list.
    Historical price data required for an asset was missing or had insufficient size or resolujtion, f.i. EOD data with 1-hour bars. Get more or better data.
  • The market was closed or the broker server delivered insufficient history (especially with MT4). Download price data from other sources and use PRELOAD.
  • A too-short or otherwise wrong test period was set up in the script (see asset). Check dates and periods in the script.
    LLarge gaps or overlapping periods in a historical data file due to download errors. Delete it and download it again,
  • A too high MinutesPerDay value for one of the used assets.
  • A wrong BarMode setting for an asset that is traded at weekends, such as cryptocurrencies.
  • A user-defined bar type that is much larger than the given BarPeriod. Decrease BarPeriod or increase MinutesPerDay for allocating more bars.

Make sure that used assets are selected in the first run, and that historical data - when needed - is sufficient for the backtest plus lookback period and is of the same type for all assets. Don't use a mix of .t1, .t2, and .t6 data, or a part of the data split into years and another part not. You can download price data from online sources with the Download script. Frequently used data is also available on the Zorro Download page. If price data for a certain year is not available, create a .t6 file of 0 bytes size with the name of the asset and year (f.i. SPX500_2017.t6). Zorro will then skip that period in the simulation and not display the error message.
https://zorro-project.com/manual/en/errors.htm

Re: How to: plot a frequency spectrum in bars? [Re: AndrewAMD] #483236
05/12/21 02:45
05/12/21 02:45
Joined: May 2021
Posts: 6
S
Sempervirens Offline OP
Newbie
Sempervirens  Offline OP
Newbie
S

Joined: May 2021
Posts: 6
Originally Posted by AndrewAMD
The manual is your friend! See the info on error code# 47:
[quote]Warning / Error 047: Not enough bars
Historical price data was invalid or insufficient for covering the test period or the LookBack period. In the latter case the script won't run. Possible reasons:
[list]The selected asset did not exist. Check your asset list.
Historical price data required for an asset was missing or had insufficient size or resolujtion, f.i. EOD data with 1-hour bars. Get more or better data.
...

Thanks for the reply, I indeed read the Error code before posting. And still could not find the solution in there. The data integrity seems to be ok (its the EURUSD M1 data from the zorro website) the asset exists, the test period was left undefined (which did not cause any problems when trying to plot other values with the plotBar function), I did not change the default value of MinutesPerDay or BarMode and the historical data i have should be enough (2005-2021). After going thru all those points I suspect the problem lies with my usage of the plotBar function, but if I' m wrong and you or anyone else has any idea of where the problem lies, please let me know. Thanks :]

Last edited by Sempervirens; 05/12/21 11:50.
Re: How to: plot a frequency spectrum in bars? [Re: Sempervirens] #483242
05/12/21 11:58
05/12/21 11:58
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Check out the Spectrum.c script.

Re: How to: plot a frequency spectrum in bars? [Re: jcl] #483243
05/12/21 12:04
05/12/21 12:04
Joined: May 2021
Posts: 6
S
Sempervirens Offline OP
Newbie
Sempervirens  Offline OP
Newbie
S

Joined: May 2021
Posts: 6
Originally Posted by jcl
Check out the Spectrum.c script.

Thanks a lot, I didn't even thought about looking at the scripts.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1