Gamestudio Links
Zorro Links
Newest Posts
Alpaca - anyone tried using them?
by DdlV. 10/28/20 19:38
Work in Indian markets
by AndrewAMD. 10/28/20 11:14
Force chart into a y-axis range?
by ozgur. 10/27/20 18:57
Special Bars Script
by atr. 10/27/20 09:06
Optimize in a ranked asset portfolio
by dBc. 10/27/20 06:33
MT4 - use more Zorro script
by danatrader. 10/27/20 06:23
TIP: Multiply Your Trade VPS
by danatrader. 10/27/20 05:48
AUM Magazine
Latest Screens
Paradox Vector
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
Who's Online Now
3 registered members (Iglarion, danatrader, 1 invisible), 473 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
xilex, exshifta, mr_T0ma5, AVL, ruins
18530 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: 5
3
3dvg Offline OP
Newbie
3dvg  Offline OP
Newbie
3

Joined: Sep 2020
Posts: 5
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.png (11 downloads)
pl_rest.png (9 downloads)
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: 299
D
danatrader Online
Member
danatrader  Online
Member
D

Joined: Mar 2019
Posts: 299
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: 5
3
3dvg Offline OP
Newbie
3dvg  Offline OP
Newbie
3

Joined: Sep 2020
Posts: 5
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: 299
D
danatrader Online
Member
danatrader  Online
Member
D

Joined: Mar 2019
Posts: 299
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: 5
3
3dvg Offline OP
Newbie
3dvg  Offline OP
Newbie
3

Joined: Sep 2020
Posts: 5
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 (11 downloads)
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: 299
D
danatrader Online
Member
danatrader  Online
Member
D

Joined: Mar 2019
Posts: 299
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