Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 600 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
New plots not showing correctly with various "PlotMode" #481447
09/17/20 22:08
09/17/20 22:08
Joined: Sep 2020
Posts: 7
3
3dvg Offline OP
Newbie
3dvg  Offline OP
Newbie
3

Joined: Sep 2020
Posts: 7
Hi, I was testing out the different PlotModes and the only one that shows the new plots correctly is the PL_ALL.

I have attached an image with setf(PlotMode, PL_ALL); (works well) >> pl_all.png

And another one with PL_LONG, PL_ALLTRADES, PL_FINE, PL_DIFF, PL_BENCHMARK and not setting "setf(PlotMode, {whatever PL});" >> pl_rest.png

Does anyone know why this happens? I have been reading https://manual.zorro-project.com/plotmode.htm
And if I do setf(PlotMode,PL_ALL+PL_FINE); works well, im assuming its because it's using PL_ALL.

Attached Files pl_all.pngpl_rest.png
Last edited by 3dvg; 09/17/20 22:09.
Re: New plots not showing correctly with various "PlotMode" [Re: 3dvg] #481448
09/17/20 23:38
09/17/20 23:38
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Is it a single instrument strategy?

Otherwise maybe:

https://manual.zorro-project.com/plotmode.htm

If plot is called several times with the same Name in the same run cycle, only the last data value is plotted. If a plot command is not called during a bar, the plotted curve will have gaps at the skipped bars. This can be used for plotting dotted lines.

Last edited by danatrader; 09/17/20 23:47.
Re: New plots not showing correctly with various "PlotMode" [Re: 3dvg] #481450
09/18/20 06:34
09/18/20 06:34
Joined: Sep 2020
Posts: 7
3
3dvg Offline OP
Newbie
3dvg  Offline OP
Newbie
3

Joined: Sep 2020
Posts: 7
It's a multi-instrument strategy (2 instruments) .

Are you suggesting that by using this
Code
setf(PlotMode,PL_ALL+PL_FINE);
... PL_ALL will go to first instrument loaded and PL_FINE to the second isntrument ?

Also another question, Is there a way to display both instruments on the same results window? It's a pairs trading strategy.

Re: New plots not showing correctly with various "PlotMode" [Re: 3dvg] #481456
09/18/20 11:22
09/18/20 11:22
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Not sure, I am suggesting PL_ALL draws it all.
PL_FINe only for the selected Asset.

https://manual.zorro-project.com/plotmode.htm
Any plot command is normally linked to the current asset. When multiple assets are traded, only prices, trades, and curves linked to the asset selected with the [Asset] scrollbox are plotted; curves linked to other assets are only plotted when PlotMode got set to PL_ALL. For plotting parameters of different assets together, store them in different variables and then plot all together without calling asset() inbetween. For instance, inside an asset loop you can store them in a var array with one element per asset, then plot all elements of the array after the asset loop. The curves are then visible on the chart when you select the last asset of the loop and click [Result].

Not sure if it is right, since you don't post code.

You can draw something like that.

char name[40];
strcpy(Asset,Asset);
var equity = EquityShort+EquityLong;
plot(Asset,equity,MAIN,color(random(100), RED, BLACK, BLUE, YELLOW, ORANGE, PURPLE, MAROON, LIGHTBLUE));

Re: New plots not showing correctly with various "PlotMode" [Re: 3dvg] #481459
09/18/20 11:52
09/18/20 11:52
Joined: Sep 2020
Posts: 7
3
3dvg Offline OP
Newbie
3dvg  Offline OP
Newbie
3

Joined: Sep 2020
Posts: 7
Not sure what you mean with the lines of code you posted.

Here's the code. I have also attached a screenshot of what I would like to see... Showing the subplots is not necessary, I just want to have both instruments showing their respective trades.


Code
#define Y "EWC"
#define X "EWA"


function run()
{
    set(PLOTNOW);
    setf(PlotMode, PL_ALL + PL_FINE);
    StartDate = 20100101;
    EndDate = 20200101;
    BarPeriod = 1440;
    LookBack = ZSLookback;
    MaxLong = MaxShort = MaxTrades;
    
    if(is(INITRUN)) {
	  string Name;
	  while(Name = loop(Y, X)){
			assetHistory(Name, FROM_AV);
	  }
    }
    

// -------------------------------
// PLOTS 
// -------------------------------  
	plot("zscore", ZScore, NEW, BLUE);
	plot(strf("#upLevel"), 2, 0, BLACK);
	plot(strf("#downLevel"), -2, 0, BLACK);
	
}

Attached Files IDEA.png
Last edited by 3dvg; 09/18/20 17:38.
Re: New plots not showing correctly with various "PlotMode" [Re: 3dvg] #481460
09/18/20 12:10
09/18/20 12:10
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
I assume then you need to use

PL_FILE - export the chart to a .png image, rather than opening the chart viewer. The file name is composed from the script name, an optional asset name, and the LogNumber.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1