READ-ONLY

The forum is now a read-only archive.

For bug reports & platform questions → [email protected]

Our community lives on Discord and YouTube — come join us!

Sum of Open P/L In Money, not working correctly.

4 replies

Perry

Subscriber, bbp_participant, community, customer, 5 replies.

Visit profile

11 years ago #113300

Hi,

 

I had created a strategy that will open two positions of two different pairs, example, when conditions are met, Enter at Maket EURUSD and at the same time Enter at Market GBPUSD.

I wrote a rule that when the sum of these two different currency pairs are in positive profit of certain amount of $$$, all two trades should close.

 

But that is not the case everytime. I found that (Open P/L In Money (EURUSD) + Open P/L In Money (GBPUSD)) >= TPinMoney does not work properly. Example: TPinMoney=$5

 

When the EA is attached to EURUSD chart, it can open both positions effectively, however in the SUM of all “P/L In money”, It can only see the Open P/L In Money for EURUSD, does not include the “Open P/L In Money of GBPUSD” in the summation.

It closes the two trades immediately when the Open P/L In Money for EURUSD is greater than $5 , even if the sum of Open P/L In Money for EURUSD & Open P/L In Money (GBPUSD) still not  greater than $5.

In another condition, even If the sum of all Open P/L In Money for EURUSD & Open P/L In Money (GBPUSD) already greater than $5, still not closing the trades until P/L In Money for EURUSD reaches above $5.

 

The other way is happening whenever I attached the EA in GBPUSD chart, it does not see the Open P/L In Money for EURUSD in the summation, but can only see the  Open P/L In Money (GBPUSD).

 

Waiting for your expert advise.

 

Thanks,

Perry

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

11 years ago #128825

yes, it works like this, this function sees PL only of trades from the same currency.

 

But there is a way around this – you can edit the function sqGetOpenPLInMoney() in the generated EA and delete or comment out the line:

      if(OrderSymbol() != Symbol()) continue;
 
this line ensures that PL of trades in symbols other than current chart symbol will be not counted.
By deleting it it will count PL of all trades.

Mark
StrategyQuant architect

0

Perry

Subscriber, bbp_participant, community, customer, 5 replies.

Visit profile

11 years ago #128840

Thanks Mark. The work around helps solve my problem.

0

PinoArla

Subscriber, bbp_participant, 1 replies.

Visit profile

6 years ago #257452

Hello Mark.

The code generated in SQ 3.8 made the info panel show the ongoing ticket number along with the specific EA P/L performance

(I think it should be this, sorry if I’m wrong

double sqGetOpenPLInMoney() {
double pl = 0;

for (int cc = OrdersTotal() – 1; cc >= 0; cc–) {
if (!OrderSelect(cc, SELECT_BY_POS) ) continue;
if(OrderType() != OP_BUY && OrderType() != OP_SELL) continue;
if(OrderSymbol() != Symbol()) continue;
if(OrderMagicNumber() != MagicNumber) continue;

pl += OrderProfit();
}

return(pl);
}

The info panel now shows the total ongoing P/L of the account, and in my opinion is not as useful as it was at the time, because if you have only one EA running, it just equals the figure you can see in the terminal, if you have more than one EAs working, you may need to evaluate the single performance, and it was really very useful like it was at the time

How can I get back to that setting? Ideally, during the building of the strategy to make it a template

 

Thank you

Attachments:
You must be logged in to view attached files.

0

Tomas Matejka

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #257546

The code for open P/L is the same for both SQX and SQ3 so it should provide the same info. I will test it

0

Viewing 4 replies - 1 through 4 (of 4 total)