Oanda REST API scripts

This forum consists of sub-forums dedicated to alternative platforms to Empty4. PM me, if you have your own favourite and I will add a sub-forum for it.
QuantHH
Posts: 3
Joined: Sun Nov 06, 2016 2:55 pm

Oanda REST API scripts

Post by QuantHH »

Yes, that is more or less the way I am thinking, checking if the trade has a profit above certain threshold, and either close them or to set a trailing stop to that price.
In python using the function sched, the event scheduler, to continuously checking the profit by each trade in repeated intervals.

thanks,
QHH
mcbusrider
Trader
Posts: 23
Joined: Sun Mar 15, 2015 4:37 pm

Oanda REST API scripts

Post by mcbusrider »

That's great, sounds like you're on the right track there.

You could possibly daemonize your script and run it as a service? If you then run the code in a "while (True):" loop, you could run the script permanently and set a time delay between iterations.

I use cron for task scheduling: are you on Linux, or Windows?
mcbusrider
Trader
Posts: 23
Joined: Sun Mar 15, 2015 4:37 pm

Oanda REST API scripts

Post by mcbusrider »

I like trailing stops for exits, as you can get a good run on trades (especially the GBP pairs at the moment-they're all over the place).

My latest script stacks into a profit run when there are no more losing trades left.

If no stopLoss has been already set on a trade, the script sets a 2 pips stop loss when a trade is in profit over 2 pips, along with the minimum trail of 5 pips.

I'm thinking of running another script once a day to close out all the worst losing trades.

The idea is to keep a lid on drawdown by offsetting some of the profits from the day to pay for the losses on the losing trade closures.

Not so important in ranging markets, but in the past I've noticed some of my losing stack trades having 2,000+ pips away from market price during a trend and it'd be nice to keep that a little bit more under control.

If once a day is too much for profit offsetting, I'll run it once every two days, see how that goes.

I'll post the script here when I've done it.
Post Reply

Return to “Alternative platforms”