Gamestudio Links
Zorro Links
Newest Posts
New Zorro version 2.35
by jcl. 02/24/21 14:40
findContract not finding a contract
by strimp099. 02/24/21 07:33
Zorro - import diff time zones csv
by AndrewAMD. 02/23/21 17:52
Using stablecoin as CCY on binance
by marr. 02/23/21 03:08
dataNew broken?
by DdlV. 02/23/21 00:55
Stop and profit/loss targets
by jpslvie. 02/22/21 19:08
Higher for at least N days in a row
by strimp099. 02/22/21 07:53
general questions about multitasking
by faustf. 02/21/21 23:36
AUM Magazine
Latest Screens
Scheherazade's Journey
Paradox Vector
The Space Between
Pogostuck: Rage With Your Friends
Who's Online Now
10 registered members (AndrewAMD, dpn, Quad, Dooley, 3run, MooseMannequin, marr, FLD, TedMar, 1 invisible), 456 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LorraineJones, SkNiX, wongkrezi, Wolf19, traderlivy
18599 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
TradeStopLimit Issue with Portfolio #482302
01/26/21 16:12
01/26/21 16:12
Joined: Jan 2021
Posts: 4
F
Figurehunter Offline OP
Guest
Figurehunter  Offline OP
Guest
F

Joined: Jan 2021
Posts: 4
I am trying to plot the TradeStopLimit as a visual comparison between what we want vs what the computer is actually doing. I have no problem with one Forex pair and it works great....

[Linked Image]

However, if I use a portfolio of pairs it uses the previous pair' s TradeStopLimit instead of the AssetBox pair. I have tried a number of filters to remove this relationship but no luck.

[Linked Image]

Code
// TradeStopLimit Sandbox ///////////////////////
function run() 
{
	set(PLOTNOW);
	LookBack  = 0;
	StartDate = 20190605;
	EndDate   = 20190610;
	BarPeriod = 30;

	while(asset(loop("GBP/USD","EUR/USD")))
	// while(asset(loop("EUR/USD")))
	{
	vars Prices = series(price(0));
 
	Stop = 20*PIP;
	Trail = 5*PIP;

		printf("\n%s************************************** %s %s %.5f L%d S%d",strdate(YMDHMS,0),Asset,AssetBox,(var)TradeStopLimit, NumOpenLong,NumOpenShort);

		if(strcmp(Asset,AssetBox)==0)
			if(NumOpenLong+NumOpenShort > 0)
		{
			printf("\n%s$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ %s %s %.5f L%d S%d",strdate(YMDHMS,0),Asset,AssetBox,(var)TradeStopLimit, NumOpenLong,NumOpenShort);
		plot("Stop",TradeStopLimit,MINV,PURPLE);
		}
		
	if(Asset=="GBP/USD")
	{
	if (ltod(UTC,0) == 0200)
      enterLong();
	if (ltod(UTC,0) == 1500)
      enterShort();
	}

	if(Asset=="EUR/USD")
	{
	if (ltod(UTC,0) == 0900)
      enterLong();
	if (ltod(UTC,0) == 1900)
      enterShort();
	}}}



Last edited by Figurehunter; 01/26/21 16:14.
Re: TradeStopLimit Issue with Portfolio [Re: Figurehunter] #482303
01/27/21 00:50
01/27/21 00:50
Joined: Jan 2021
Posts: 21
Singapore
S
strimp099 Offline
Newbie
strimp099  Offline
Newbie
S

Joined: Jan 2021
Posts: 21
Singapore
Is this outcome you're trying to achieving a plot that has the selected pair plotted along with the stop set for that selected pair? The documentation in the manual for `plot` says: "Plots a variable, or the first element of the Data series, on the current bar position on the chart, and exports it optionally to a CSV file. The value can be plotted as a dot, line, bar, or band, dependent on Type. The plot is linked to the current asset." Note the last sentence. Perhaps one of the other plotting functions is better suited?

Last edited by strimp099; 01/27/21 00:57.
Re: TradeStopLimit Issue with Portfolio [Re: Figurehunter] #482308
01/27/21 09:29
01/27/21 09:29
Joined: Jul 2000
Posts: 27,450
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,450
Frankfurt
Not the plot function is wrong, but the rest. If you want to plot a stop limit of a particular trade, first select that trade, and then plot its stop limit. Selecting trades and using their variables is described in the manual under "Trade management".


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1