Dukascopy
 
 
Wiki JStore Search Login

Can't update the Position.Comment after the position has been created.
 Post subject: Can't update the Position.Comment after the position has been created. Post rating: 0   New post Posted: Tue 23 Jun, 2015, 21:52 
User avatar

User rating: 0
Joined: Sun 01 Feb, 2015, 22:49
Posts: 81
Location: RomaniaRomania
Hi,

I want to store some run-time variable in the Position.Comment.
but can't after the position has been created.

If I attempt to do this with an Assign block I get
"you can't put here read only variables"

This would be very helpful because I get the comment in the report.

Regards,
mosu_d


 
 Post subject: Re: Can't update the Position.Comment after the position has been created. Post rating: 0   New post Posted: Thu 25 Jun, 2015, 09:48 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

The run-time parameters information is available at the end of every test in both VJF and Jforex historical tester, here below the VJF one:

Image

If you need to include these information as a comment in your trading command, you can still write this in a dedicated variable with the type string and insert it.

Else; please advice


Cheers


Attachments:
RunTimeParam.JPG [23.58 KiB]
Downloaded 342 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Can't update the Position.Comment after the position has been created. Post rating: 0   New post Posted: Mon 29 Jun, 2015, 21:02 
User avatar

User rating: 0
Joined: Sun 01 Feb, 2015, 22:49
Posts: 81
Location: RomaniaRomania
Hi,

I am not referring to the strategy input parameters.

I want to save computed values into the Position.Comment,
not with the constructor (when the position is opened), but afterwards, when the position is still pending.
Image

This would help me to make some statistical analysis if I manage to gather the data.
If you allow me to extend the topic, the generic question would be:
Is there a way I can generate logging output to some console? Like print variable X to console if some condition is met.

Regards,
mosu_d


Attachments:
UpdatePositionComment.png [53.7 KiB]
Downloaded 316 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Can't update the Position.Comment after the position has been created. Post rating: 0   New post Posted: Thu 02 Jul, 2015, 12:42 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

I see what you meant.
Unfortunately the option to "print" a message is not available but it is under discussion for future implementation. There is no plan communicated as it is still under feasibility study.

The variable comment (when used) is attached as it is to the order command when triggered. If you need to assign a comment based on a specific event you can still create a custom variable and assign a different comment:


Image

If you're using read-only variables, it is not possible to overwrite a value as you may noticed.
So basically you need to assign a comment to a pending order (Limit /Stop /MIT) after being sent to the market and before getting executed ? is this correct ?

details details details are more than welcome !


 
 Post subject: Re: Can't update the Position.Comment after the position has been created. Post rating: 0   New post Posted: Fri 03 Jul, 2015, 22:30 
User avatar

User rating: 0
Joined: Sun 01 Feb, 2015, 22:49
Posts: 81
Location: RomaniaRomania
Hi Amine,

Following the advice from your reply I have updated my strategy and it works (very surprising for me !!!).
But thank you.

What I did:

1. Create sting variable positionText with Initial Value = Initial Text

2. Added this to the Position definition
Image

3. Updated the variable positionText when the price was ~ close to my position
Image

4. Exported strategy and run it in Historical Tester on jForex. See report at the end:
Image

But this is not very useful yet.
Now going further, I wanted to assign in the Trade.Comment a Double variable. As you can imagine, a similar error was raised. Which is a shame. Java has automatic casting.

5. Find my text in the .java strategy
Image

6. And update "comsa"
Image

7. Exported strategy and run it in Historical Tester on jForex. See report at the end:
Image

This is useful now....
But it all can be avoided if you would create a setter method to the Trade.Comment as it has for SL and TP.


Attachments:
5.png [7.56 KiB]
Downloaded 313 times
6.png [39.97 KiB]
Downloaded 276 times
5.png [7.56 KiB]
Downloaded 189 times
4.png [7.3 KiB]
Downloaded 292 times
3.png [19.93 KiB]
Downloaded 299 times
2.png [35 KiB]
Downloaded 289 times
1.png [17.87 KiB]
Downloaded 323 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Can't update the Position.Comment after the position has been created. Post rating: 0   New post Posted: Fri 03 Jul, 2015, 22:37 
User avatar

User rating: 0
Joined: Sun 01 Feb, 2015, 22:49
Posts: 81
Location: RomaniaRomania
.... Ran out of space to attach pictures ;/


This is useful now....
But it all can be avoided if you would create a setter method to the Trade.Comment as it has for SL and TP.
Image


As a conclusion, this is a workaround for console printing. Ugly and inefficient...

But now I see there is a setLabel which (I guess) prints it directly on the chart. This would be interesting.

Cheers,
mosu_d.


Attachments:
7.png [16.06 KiB]
Downloaded 331 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com