Check if Profit is Locked In

Posted By: OptimusPrime

Check if Profit is Locked In - 11/04/20 17:13

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.
Posted By: kalmar

Re: Check if Profit is Locked In - 11/04/20 18:08

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;
}
Posted By: OptimusPrime

Re: Check if Profit is Locked In - 11/05/20 00:37

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 !
Posted By: MatPed

Re: Check if Profit is Locked In - 11/05/20 10:45

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
Posted By: danatrader

Re: Check if Profit is Locked In - 11/05/20 10:59

\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?
Posted By: MatPed

Re: Check if Profit is Locked In - 11/05/20 12:59

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.
© 2024 lite-C Forums