Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 770 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Closing prohibited - check NFA flag! #484989
01/05/22 17:15
01/05/22 17:15
Joined: Jan 2022
Posts: 29
C
coinpump Offline OP
Newbie
coinpump  Offline OP
Newbie
C

Joined: Jan 2022
Posts: 29
Hi everyone, I'm testing in live mode to better understand. Zorro opened a long trade, and also exited the trade successfully, but I see this message. It did not enter a short position though when it was supposed to.

Closing prohibited - check NFA flag!
[BTCUSDT::L00002] - can't close at attempt 1, 1@46438.16 at 17:11:06

I am using the stock plugin of binance futures. Thank you!


[Wed 22-01-05 17:15] 161 -0.0121 0/1 (46358.13)
Closing prohibited - check NFA flag!
[BTCUSDT::L00002] - can't close at attempt 2, 1@46358.13 at 17:15:00
!BTCUSDT: SELL 0.001 (q1 x la0.001) at MARKET
[BTCUSDT::S00003] Short 1@46358.13 Risk 0 at 17:15:00

(This did not enter a short position, only closed the long)

Here's the code:
Code
	if (crossOver(DEMAShort, DEMALong)) enterLong();
	if (crossUnder(DEMAShort, DEMALong)) enterShort();




Last edited by coinpump; 01/05/22 17:28.
Re: Closing prohibited - check NFA flag! [Re: coinpump] #484991
01/06/22 09:28
01/06/22 09:28
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Have you checked the NFA flag?

Re: Closing prohibited - check NFA flag! [Re: Spirit] #484995
01/06/22 14:17
01/06/22 14:17
Joined: Jan 2022
Posts: 29
C
coinpump Offline OP
Newbie
coinpump  Offline OP
Newbie
C

Joined: Jan 2022
Posts: 29
Thank you for the well thought out response. I hadn't thought of checking the NFA flag. *eyeroll*

Re: Closing prohibited - check NFA flag! [Re: coinpump] #484998
01/06/22 16:10
01/06/22 16:10
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Good, then it solved the problem.

Re: Closing prohibited - check NFA flag! [Re: AndrewAMD] #485000
01/06/22 16:37
01/06/22 16:37
Joined: Jan 2022
Posts: 29
C
coinpump Offline OP
Newbie
coinpump  Offline OP
Newbie
C

Joined: Jan 2022
Posts: 29
No, it did not solve the problem.
Why would closing be prohibited?
Why are you "expert users" so unhelpful to non experts? Borderline hostile... Because you do not want others to succeed?
I do on purpose to post my "stupid questions" here in separate threads so that search engines can find it and other newbies might find it useful. Perhaps that part has escaped you.

"This forum is the right place to post beginner's questions"
Apparently, you're in the wrong forum. Is there a "snippy and unhelpful answers" forum for you to join?

Last edited by coinpump; 01/06/22 16:40.
Re: Closing prohibited - check NFA flag! [Re: coinpump] #485001
01/06/22 16:47
01/06/22 16:47
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Well then, you didn't set the NFA flag. Maybe you should set the NFA flag.

If you're using the TradeTest script, enable NFA in the pop-up GUI.

If you're using your own script, make sure set(NFA) is somewhere near the top of run().

The set() function and NFA flag are defined here:
https://zorro-project.com/manual/en/mode.htm

If you're still confused, post your script.

Re: Closing prohibited - check NFA flag! [Re: coinpump] #485006
01/06/22 19:01
01/06/22 19:01
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
>>Why are you "expert users" so unhelpful to non experts? Borderline hostile...<<

No one is hostile. All want to help. Many are also beginners with algo trading.

The problem: You're asking many questions that you won't have to ask when you even superficially go through the beginners tutorial. This draws sarcastic responses. When you see a message like "check NFA flag", you should be able to look up "NFA flag" in the help file and understand what it is. If then still something is unclear, maybe because the description is not good enough, you have all the right in the world to complain and ask.

Zorro is not an aim-and-click tool. You need to be on a scripting level, and need be able to use a manual.

Re: Closing prohibited - check NFA flag! [Re: jcl] #485011
01/07/22 22:51
01/07/22 22:51
Joined: Jan 2022
Posts: 29
C
coinpump Offline OP
Newbie
coinpump  Offline OP
Newbie
C

Joined: Jan 2022
Posts: 29
I apologize for being impatient.

I have read the manual section about NFA... but I do not understand what it means.
"Directly closing positions is not allowed"

How can you close a position then? You can close a position manually (how else are you supposed to realize a profit?). What is the issue ?

I cannot open a simultaneous long and short position on binance. According to the manual, that means it is NFA compliant. So how do I close a trade?
Can you please provide me with an example how to exit a trade?

I am on a scripting level, but I am neurodivergent and I do not learn the same way as others. I wrote my own trading scripts in python. I also have coded in pinescript. Zorro team has done more than I could do in a lifetime so I am switching to learning Zorro now. Can you please point me to a workshop, or provide a code sample that will enter and exit a trade in live mode?

Code
#include <profile.c>
function run(){
	
	BarPeriod = 1;
	LotAmount = 0.001;

	Stop = 1.233;
	
	vars Close = series(priceClose());

	vars DEMAShort = series(DEMA(Close,7.03));
	vars DEMALong = series(DEMA(Close,32));

	if (crossOver(DEMAShort, DEMALong)) 
		enterLong();

	if (crossUnder(DEMAShort, DEMALong)) 
		enterShort();
	
	
}





Thank you for your time.

Last edited by coinpump; 01/07/22 22:53.
Re: Closing prohibited - check NFA flag! [Re: coinpump] #485012
01/08/22 00:12
01/08/22 00:12
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands

Re: Closing prohibited - check NFA flag! [Re: Grant] #485013
01/08/22 00:40
01/08/22 00:40
Joined: Jan 2022
Posts: 29
C
coinpump Offline OP
Newbie
coinpump  Offline OP
Newbie
C

Joined: Jan 2022
Posts: 29
Code
	if (crossOver(DEMAShort, DEMALong)) 
		exitLong();
		enterLong();
	if (crossUnder(DEMAShort, DEMALong)) 
		exitShort();
		enterShort();

like this?

or do I need a condition first that checks if it has an open position?

Last edited by coinpump; 01/08/22 00:40.
Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1