Gamestudio Links
Zorro Links
Newest Posts
ZorroFix. ini /data and /log path
by jcl. 12/09/25 10:06
Zorro 2.70
by jcl. 12/09/25 10:03
Parameter selection
by jcl. 12/01/25 12:28
ZorroGPT
by TipmyPip. 11/29/25 09:38
webGL
by Ezzett. 11/27/25 23:22
Chart viewer
by clint000. 11/27/25 21:21
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (AndrewAMD, Quad, mosfet, TipmyPip), 21,020 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
agasior, mosfet, MonsterX, KF_Investments, Luuk
19186 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Binance Futures - problems with closing open trades #489009
12/05/25 18:16
12/05/25 18:16
Joined: Dec 2025
Posts: 4
Essen
M
mosfet Online OP
Guest
mosfet  Online OP
Guest
M

Joined: Dec 2025
Posts: 4
Essen
I have set my Binance Futures account to "One Way Only" which is equivalent to NFA compliant and set the NFA flag in Accounts.csv. My test script (see below) can open positions fine, however after the expiry of the LifeTime for the trade it can't close the position. I get the following error:

[BNBUSDT::L00004] - can't close 1@880.47 at 17:42:00
Error 075 - closing not supported (NFA?)


What am I missing here? Or is this an issue with the plugin. My test script is below

#include <profile.c>


void run()
{
set(TESTNOW|PLOTNOW|PARAMETERS|LOGFILE|NOLOCK|PRELOAD);
/// -- Optimitzation and WFO TICKS

StartDate = ifelse(Live, NOW, 20210401);
BarPeriod = 2;// 1440;
BarZone = CET;
EndDate = 20251130;
resf(BarMode, BR_WEEKEND); // allow weekend trading
LookBack=150;

//if (is(INITRUN)) Hedge = 1;

//UpdateDays = -1;

//setf(TradeMode,TR_GTC); //set orders as good-till-canceled for option spreads; TR_POS =only exit a trade if the position exists
setf(TradeMode,TR_POS);

MaxLong = MaxShort = 1;

while (asset(loop("BNBUSDT"))) //"TSLA.us", "AMZN.us", "MSFT.us", "AAPL.us" //"JPM.us", "PFE.us", "META.us", "WMT","NOW","INTC", "NVDA"
{

/// - Test that lifetime means trade is correctly closed
if (Bar - StartBar > 1 and NumOpenLong < 1) return quit("\nTEST OF BINANCE FUTURES COMPLETED");

LifeTime = 1;
if (NumOpenLong < 1 and !is(LOOKBACK)) enterLong();


}
}

Re: Binance Futures - problems with closing open trades [Re: mosfet] #489010
12/06/25 12:03
12/06/25 12:03
Joined: Dec 2025
Posts: 4
Essen
M
mosfet Online OP
Guest
mosfet  Online OP
Guest
M

Joined: Dec 2025
Posts: 4
Essen
A properly formatted version of the script:

Code

#include <profile.c>


void run() 
{
	set(TESTNOW|PLOTNOW|PARAMETERS|LOGFILE|NOLOCK|PRELOAD);

	StartDate = ifelse(Live, NOW, 20210401);
	BarPeriod = 2;// 1440;
	BarZone = CET;
	EndDate = 20251130;
	resf(BarMode, BR_WEEKEND); // allow weekend trading
	LookBack=150;

	
	setf(TradeMode,TR_POS);

	MaxLong = MaxShort = 1;
	
	while (asset(loop("BNBUSDT")))   
	{		
		
		/// - Test that lifetime means trade is correctly closed
		if (Bar - StartBar > 1 and NumOpenLong < 1) return quit("\nTEST OF BINANCE FUTURES COMPLETED");
		
		LifeTime = 1;
		if (NumOpenLong < 1 and !is(LOOKBACK)) enterLong();
	
		
	}
}


Re: Binance Futures - problems with closing open trades [Re: mosfet] #489013
Yesterday at 09:59
Yesterday at 09:59
Joined: Jul 2000
Posts: 28,039
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,039
Frankfurt
Listen to the error message! AFAIK Binance is a NFA broker.

Re: Binance Futures - problems with closing open trades [Re: mosfet] #489016
Yesterday at 19:09
Yesterday at 19:09
Joined: Dec 2025
Posts: 4
Essen
M
mosfet Online OP
Guest
mosfet  Online OP
Guest
M

Joined: Dec 2025
Posts: 4
Essen
That is what I thought so I set the NFA flag in Accounts.csv as the documentation states. But when the LifeTime expires and Zorro tries to close it I get the error. Setting the NFA flag explicitly in the script did not help either.

I have worked around it by entering opposite positions instead of using the exit functions and that works.

Last edited by mosfet; Yesterday at 19:09.
Re: Binance Futures - problems with closing open trades [Re: mosfet] #489017
10 hours ago
10 hours ago
Joined: Jul 2000
Posts: 28,039
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,039
Frankfurt
Hmm, NFA does just that automatically. Maybe it is accidentally reset in your script at some other place?

Re: Binance Futures - problems with closing open trades [Re: mosfet] #489018
1 hour ago
1 hour ago
Joined: Dec 2025
Posts: 4
Essen
M
mosfet Online OP
Guest
mosfet  Online OP
Guest
M

Joined: Dec 2025
Posts: 4
Essen
Well maybe one of the flags or trademodes I set in the script, reset it. I will go through the doc again. But the code above is all there is to the script


Moderated by  Petra 

Gamestudio download | 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