Calculate return and place order
Calculate return and place order
15 Mar 2016, 12:32
Goodmorning all,
Here is a "simple" problem I visibly can't solve by myself :
I would like to calcule the return of two different currencies (for instance : EURUSD and CHFUSD) between two bars. After that, I would like to use the computed return and multiply it by a "base" (i.e. 100) set at a specific date (9:00 GMT+1) each day, and use this result to place orders along the day.
It looks like this :
- 15/03/2016 9:00 : EUR/USD = 100 and USD/CHF = 100
Let's say EUR/USD has returned 0.5% between 9:00 and 9:01 and USD/CHF -0.5%, I'd like to have something like that.
- 15/03/2016 9:01 : EUR/USD = 100 * (1+0.005) and USD/CHF = 100 * (1-0.005)
=> if EUR/USD index value > USD/CHF index value : SELL order (that's a stupid example btw)
Can somebody help with that ?
Thanks a lot for your help,
B.
Replies
badger.cook
17 Mar 2016, 13:50
Sorry for the delay. I used (0) and (1) because I saw it on another robot based on MA and EMA, and which was working.
What I want to do here is to create a kind of "index" that moves with the bar return of the currency. Based on the value of the two indices calculated by the robot (one for EURUSD and one for USDCHF), I want to make buy and sell orders for these two currency pairs.
I first have no idea how to create the "indices" and second have no idea how I could specify I want the last value of the index or the value 1 or 2 bars ago.
Could somebody help with that ?
Thanks a lot,
B.
@badger.cook
Spotware
24 Mar 2016, 13:58
Dear Trader,
Please have a look at the API Guides and Last() method in our API Reference.
@Spotware
badger.cook
15 Mar 2016, 13:35
This is what I currently have but I'm sure I'm missing something. Thanks for your help.
@badger.cook