Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Nymphodora, AndrewAMD), 789 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Check if Profit is Locked In #481813
11/04/20 17:13
11/04/20 17:13
Joined: Aug 2018
Posts: 98
O
OptimusPrime Offline OP
Junior Member
OptimusPrime  Offline OP
Junior Member
O

Joined: Aug 2018
Posts: 98
Hi Team:

Sorry. I have been away learning another language and I am now a bit mixed up in my previous Zorro knowledge.

The ! mark in the display tells us that a profit has been locked in. What is the function call that detects that? How do I check for this in my code itself? I want to add an extra piece of code as insurance to detect when my script fails to lock in profits so I can tell it to do so.


Thanks so much,

OptimusPrime

Re: Check if Profit is Locked In [Re: OptimusPrime] #481814
11/04/20 18:08
11/04/20 18:08
Joined: Oct 2017
Posts: 56
Munich
K
kalmar Offline
Junior Member
kalmar  Offline
Junior Member
K

Joined: Oct 2017
Posts: 56
Munich
I'm not sure if I understood you correctly, but in variables.h there are these 2 variables:

#define ProfitClosed (WinLong-LossLong+WinShort-LossShort)
#define ProfitOpen (WinValLong-LossValLong+WinValShort-LossValShort)

So we could do this:

// sum up closed profits of all assets and the current algo
var ProfitSum = 0;
for(used_assets) {
asset(Asset); // select the current component
ProfitSum += ProfitClosed;
}

Re: Check if Profit is Locked In [Re: OptimusPrime] #481817
11/05/20 00:37
11/05/20 00:37
Joined: Aug 2018
Posts: 98
O
OptimusPrime Offline OP
Junior Member
OptimusPrime  Offline OP
Junior Member
O

Joined: Aug 2018
Posts: 98
Thanks Kalmar. What I am asking is about the state of the open profits. Once we are trailing an open position and some of the profit has been locked in, the display window shows an exclamation mark. !

I want to be able to check within the code if the open profit is locked in by our trailing stop status. i.e. the same status that is displayed by the !


Thanks so much,

OptimusPrime

Re: Check if Profit is Locked In [Re: OptimusPrime] #481821
11/05/20 10:45
11/05/20 10:45
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
I am not aware of such functionality, it would be helpful, I was thinking to develop it analyzing the info contained in the trade struct. its on my "never ending" todo list laugh

Re: Check if Profit is Locked In [Re: OptimusPrime] #481822
11/05/20 10:59
11/05/20 10:59
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
\include\trading.h

typedef struct TRADE
{
Line 187: float fTrailLock; // profit target distance to initial price, positive (long) or negative (short)

Maybe this value can be read?
If yes, how?

Last edited by danatrader; 11/05/20 11:00.
Re: Check if Profit is Locked In [Re: OptimusPrime] #481823
11/05/20 12:59
11/05/20 12:59
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
I was thinking using a TMF: you know all the variables of the specific trade (ENTRY,.. STOP... TRAIL,.... You can make all the required calculations and take actions.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1