Need help with crossover bot

Created at 19 Aug 2015, 20:42
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MA

marcwilliam33

Joined 18.08.2015

Need help with crossover bot
19 Aug 2015, 20:42


Hi, I'm sure this is very simple, and I have been trying for to long so asking for help.  In short I can't figure out how to code a crossover on the way back down or up.  Example CCI has gone up to 200 and has turned and crossed 150 at which point I would like the bot to open a sell order and the same in reverse CCI has gone -200 and on the way backup crossing -150 it would open a buy order.

The crossover going up or down is easy, but I can't figure out how to make a bot not open on the initial crossover, but on the way back down or up

Any help would be great thank you!

 

 


@marcwilliam33
Replies

ClickAlgo
20 Aug 2015, 09:26

Create a boolean flag which gets set true when the CCI reaches 200 and false when its below 150 then incorporate it into the logic below

 cci.Result.IsFalling() && cci.Result.LastValue < 150 // open sell order

you should be able to work the rest out.


@ClickAlgo

marcwilliam33
20 Aug 2015, 14:53

T​hanks!  I will try that.  Horrible programmer so I will see.  Thanks!


@marcwilliam33

ClickAlgo
20 Aug 2015, 15:38

Give it a good go and give me a shout of you get stuck.


@ClickAlgo

marcwilliam33
20 Aug 2015, 17:09

I don't know much about bootlean and how to add it in.  I sent you an email.  Thanks!


@marcwilliam33