Gamestudio Links
Zorro Links
Newest Posts
DirectX : 3d Hardware Reset Failure
by 3run. 12/01/20 18:23
CQG
by AndrewAMD. 12/01/20 15:09
Zorro on Linux
by andydoc. 12/01/20 15:06
About path_create
by 20BN. 12/01/20 08:10
Votes for future features
by Naicigam. 11/30/20 21:49
Directa Broker
by fumo59. 11/30/20 17:22
Moving average range filter
by MatPed. 11/30/20 14:38
AUM Magazine
Latest Screens
Paradox Vector
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
Who's Online Now
0 registered members (), 466 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
paco101, fumo59, andydoc, lento, Karakis
18548 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to plotHistogram in combined strategy? #481002
07/31/20 11:34
07/31/20 11:34
Joined: May 2020
Posts: 31
A
AdamWu Offline OP
Newbie
AdamWu  Offline OP
Newbie
A

Joined: May 2020
Posts: 31
Dear all, according to manual this code is working perfectly:
Code
#include <profile.c>
function run()
{
  BarPeriod = 1440;
  StartDate = 2015;
  NumYears = 1;
  LookBack = 0;
 
  // run this simulation 1000 times  
  NumTotalCycles = 100;
 
  // some random trading strategy
  if(random() > 0)
    enterLong();
  else 
    enterShort();
 
  // plot the result of every run in a bar graph  
  if(is(EXITRUN))
    plotHistogram("Profits",Balance/PIPCost,250,1,RED);   
}


But when use similar code to a portfolio trend + counter trend strategy, it shows "Erro 047: No bars to plot":
Code
#include <profile.c>
function run(){
	if(Train){
		StartDate = 20190131;
		EndDate = 20200731;
		NumWFOCycles = 3;
	} else {
		StartDate = 20200627;
	}
	BarPeriod = 60;
	LookBack = 700;

	NumTotalCycles = 6;

	assetList("AssetsFXCMLite");
	while(loop(Assets)){
		asset(Loop1);
		while(algo(loop("TRND","CNTR"))){
			if(Algo == "TRND"){
				tradeTrend();
			}
			if(Algo == "CNTR"){
				tradeCounterTrend();
			}
		}
	}

	if(is(EXITRUN))
		plotHistogram("Profits",Balance/PIPCost,100,1,RED);   
}


How can I plotHistogram in this strategy? Thans a lot.

Last edited by AdamWu; 07/31/20 12:56.
Re: How to plotHistogram in combined strategy? [Re: AdamWu] #481003
07/31/20 12:58
07/31/20 12:58
Joined: May 2020
Posts: 31
A
AdamWu Offline OP
Newbie
AdamWu  Offline OP
Newbie
A

Joined: May 2020
Posts: 31
By debuging around, I seems this loop causes the problem:

Code
while(algo(loop("TRND","CNTR"))){}


But I have no idea how to solve this problem. Any idea is warmly welcome!

Re: How to plotHistogram in combined strategy? [Re: AdamWu] #481004
07/31/20 13:38
07/31/20 13:38
Joined: Feb 2017
Posts: 1,131
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,131
Chicago
I would start by looking closely at the description of warning 047, there are many helpful hints!
https://zorro-trader.com/manual/en/errors.htm


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1