Gamestudio Links
Zorro Links
Newest Posts
Missing z.ini in Zorro 2.30
by kalmar. 09/28/20 21:15
File & directory paths - the others
by danatrader. 09/28/20 17:00
Sky and Water not working correctly?
by NeoDumont. 09/28/20 11:26
Real Execution problems
by rafaelghd. 09/28/20 10:54
Accessing component equity curve
by Petra. 09/27/20 13:30
Error message for Edit and Result
by DripDrop. 09/26/20 14:50
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
11 registered members (AndrewAMD, Dooley, MatPed, kalmar, BlackJack, Janusz, marr, 3run, alibaba, 1 invisible), 460 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Average, DripDrop, zzy, NewBorn, 3dvg
18518 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,101
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,101
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