Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 642 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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: 45
A
AdamWu Offline OP
Newbie
AdamWu  Offline OP
Newbie
A

Joined: May 2020
Posts: 45
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: 45
A
AdamWu Offline OP
Newbie
AdamWu  Offline OP
Newbie
A

Joined: May 2020
Posts: 45
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,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

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