Gamestudio Links
Zorro Links
Newest Posts
Access Denied with Zorro S
by German. 06/24/21 14:42
EXITRUN for TRADE
by jcl. 06/24/21 10:09
BarOffset for per-bar oversampling
by Sempervirens. 06/24/21 02:39
Players Health
by rayp. 06/23/21 19:04
Acknex-Configuration
by 3run. 06/21/21 16:39
AUM Magazine
Latest Screens
Hecknex World
Scheherazade's Journey
Paradox Vector
The Space Between
Who's Online Now
8 registered members (AndrewAMD, 3run, Sempervirens, German, RealSerious3D, x34v, 2 invisible), 441 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Bonobo791, damasceno, peterr991, fx2201, adaptivetrader
18657 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: 4
S
Sempervirens Online OP
Guest
Sempervirens  Online OP
Guest
S

Joined: May 2021
Posts: 4
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,278
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,278
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: 4
S
Sempervirens Online OP
Guest
Sempervirens  Online OP
Guest
S

Joined: May 2021
Posts: 4
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,536
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,536
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: 4
S
Sempervirens Online OP
Guest
Sempervirens  Online OP
Guest
S

Joined: May 2021
Posts: 4
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