Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

How to store the value at which the conditions meet in a variable
 Post subject: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 13:49 

User rating: 0
Joined: Tue 16 Oct, 2012, 12:23
Posts: 40
To Dukascopy Support,

I want to save the value at which the conditions for taking a trade are met in a variable. My strategy is such that sometimes the value at which the conditions are met for taking a trade and the value at which the trade is opened are different.

For example, if stochastic fast crosses stochastic slow, a BUY trade should be taken. According to my strategy a buy trade is taken due to another condition as well. But I want to store the value at which the conditions for a BUY or SELL trade are met in a variable. Kindly suggest a method. Thanks.

Jimmy. :)


 
 Post subject: Re: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 14:10 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
For indicator calculation see:
https://www.dukascopy.com/wiki/#Indicator_Calculation
See a strategy which employs a similar algorithm:
https://www.dukascopy.com/wiki/#SMA_Simple


 
 Post subject: Re: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 14:50 

User rating: 0
Joined: Tue 16 Oct, 2012, 12:23
Posts: 40
I am sorry but I don't think any of the above suggestions address my problem. I wish to make indicator calculation since the point of time the conditions for taking the trade are met. The above suggestions address only to indicator calculation by shift, candle interval and time interval.

Please suggest another method. Thanks.


 
 Post subject: Re: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 15:23 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please elaborate which pieces of information you are not able to find in our wiki.


 
 Post subject: Re: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 15:41 

User rating: 0
Joined: Tue 16 Oct, 2012, 12:23
Posts: 40
The value at which the conditions for taking a trade are met, is to be stored in a variable.
For example, if the conditions for taking a EURUSD trade are met at 1.3200, then this value is to be stored in a variable so that it can be used for closing of the trade with respect to it.

Could you please suggest a method or an example in wiki to do that?


 
 Post subject: Re: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 15:49 

User rating: 0
Joined: Tue 16 Oct, 2012, 12:23
Posts: 40
It should be similar to this but instead of the value at which the trade is opened, it should be the value at which the conditions for opening the trade are met.

https://www.dukascopy.com/wiki/#History_ ... ce_dynamic


 
 Post subject: Re: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 15:59 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please give precise examples of:
  • Conditions.
  • Actions on meeting the conditions.


 
 Post subject: Re: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Thu 18 Oct, 2012, 19:21 

User rating: 0
Joined: Tue 16 Oct, 2012, 12:23
Posts: 40
I am attaching a strategy which explains what I want to add.

Acc. to this strategy when the conditions for BUY trade are fulfilled, the BUY trade would be taken and if it breaches the level of 25 pips ONCE and then crosses it back, the trade would be closed.

Similarly, a SELL trade would be taken when the SELL conditions are fulfilled and if it falls below a level of 25 pips ONCE and rises above it again, the trade would be closed.

Now, on line 88, the condition is

priceLevel = order.getOpenPrice() + instrument.getPipValue() * 25;

In this condition along with order.getOpenPrice(), which fetches the value at which the trade was opened, I also want to include the value at which the conditions for opening the trade were met. This is because the value at which the conditions for opening the trade are met and the value at which the trade is opened are not always the same. Sometimes they are different. Hence, I wish to include this condition as well.

I hope you have now got the idea of what I wish to include in my strategy. I request you to suggest a method to fetch the value at which the conditions for opening a trade are met.


Attachments:
SMASimpleStrategy.java [6.47 KiB]
Downloaded 306 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: How to store the value at which the conditions meet in a variable Post rating: 0   New post Posted: Sat 20 Oct, 2012, 13:44 

User rating: 0
Joined: Tue 16 Oct, 2012, 12:23
Posts: 40
Thanks for your help. I have found another way in which my issue can be addressed instead of fetching the value at which the conditions for opening the trade are met.


 

Jump to:  

  © 1998-2025 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