Dukascopy
 
 
Wiki JStore Search Login

EMA Crossover and Opening/Closing Positions on MTF
 Post subject: EMA Crossover and Opening/Closing Positions on MTF Post rating: 1   New post Posted: Tue 19 May, 2015, 12:36 
User avatar

User rating: 1
Joined: Mon 18 May, 2015, 08:19
Posts: 1
Location: AustraliaAustralia
Hello,

I would please like to ask some questions which have to do with a strategy I'm trying to code.

Firstly, what is best to use for a MA Crossover system - ONTICK or ONCANDLE? Is tick to small to measure and so should ONCANDLE be used? What is the effect of Shift 1 on ONTICK? Is that just going to look at the previous tick price which may mean a 0.00001 price movement on a pair like the EURUSD?

Secondly, I am having trouble coding a Multiple Time Frame (MTF) crossover system. I use 3 EMAs on the Daily TF and 3 on the 15 minute TF.

The parameters confuse me too. The MTF is Daily and 15 minute.
Period: 15 Mins
Interpolate by: Tick on Open
OfferSide: Bid
Range: Last Month
Begin Date: Wed Apr 1 2015 10:00:00 AM
End Date: Fri May 1 2015 09:59:59 AM
Money: 50000


The first thing I do in the Visual JForex is check if a position is open/exists and a crossover of the 2 smaller EMAs has occurred and if so, I close the position, if not I then check if a BUY/SELL crossover has occurred.

To do this I initially use POSITIONS VIEWER BLOCK -> Positions.ALL POSITIONS -> Current Position.MY POSITION. I link this to an IF STATEMENT BLOCK via the CycleEnd - the flow happens only when all block iterates all collection positions, i.e. the right hand output link.

Thirdly, is using an IF STATEMENT BLOCK for All Positions.POSITION AMOUNT = 0 the correct way to initiate a trade. In other words, does this check to see if I have no OPEN or PENDING positions and if not (= 0), a position is submitted?

Have I done something wrong somewhere because I am unable to initiate any positions?

Thank you,
Chrysos.


 
 Post subject: Re: EMA Crossover and Opening/Closing Positions on MTF Post rating: 0   New post Posted: Fri 22 May, 2015, 04:27 

User rating: 1
Joined: Mon 01 Sep, 2014, 13:39
Posts: 34
Location: AustraliaAustralia
Chrysos2 wrote:
Hello,

I would please like to ask some questions which have to do with a strategy I'm trying to code.

Firstly, what is best to use for a MA Crossover system - ONTICK or ONCANDLE? Is tick to small to measure and so should ONCANDLE be used? What is the effect of Shift 1 on ONTICK? Is that just going to look at the previous tick price which may mean a 0.00001 price movement on a pair like the EURUSD?

Secondly, I am having trouble coding a Multiple Time Frame (MTF) crossover system. I use 3 EMAs on the Daily TF and 3 on the 15 minute TF.

The parameters confuse me too. The MTF is Daily and 15 minute.
Period: 15 Mins
Interpolate by: Tick on Open
OfferSide: Bid
Range: Last Month
Begin Date: Wed Apr 1 2015 10:00:00 AM
End Date: Fri May 1 2015 09:59:59 AM
Money: 50000


The first thing I do in the Visual JForex is check if a position is open/exists and a crossover of the 2 smaller EMAs has occurred and if so, I close the position, if not I then check if a BUY/SELL crossover has occurred.

To do this I initially use POSITIONS VIEWER BLOCK -> Positions.ALL POSITIONS -> Current Position.MY POSITION. I link this to an IF STATEMENT BLOCK via the CycleEnd - the flow happens only when all block iterates all collection positions, i.e. the right hand output link.

Thirdly, is using an IF STATEMENT BLOCK for All Positions.POSITION AMOUNT = 0 the correct way to initiate a trade. In other words, does this check to see if I have no OPEN or PENDING positions and if not (= 0), a position is submitted?

Have I done something wrong somewhere because I am unable to initiate any positions?

Thank you,
Chrysos.
Hi, I think I've answered all my questions by intense investigation for a solid day. All is as I assumed it was.

However I'd like more clarification of the part in red above please. With ONTICK using a Shift = 1, that is looking at the previous candle's specified period, usually the CLOSE. Does that mean Shift = 0 is looking at the current candle tick by tick and comparing to to the CLOSE of the previous candle? I assume yes. ONCANDLE looks at the CLOSE of the current and previous candles and compares the two? Again I assume yes.

Thank you,
Chrysos.


 
 Post subject: Re: EMA Crossover and Opening/Closing Positions on MTF Post rating: 0   New post Posted: Mon 25 May, 2015, 22:17 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Hi,

Maybe I am going to tell things that are already clear, but based on your posts, I am not sure...
Also, I am not familiar with the Visual JForex platform, only with the JForex SDK and API.
Quote:
What is the effect of Shift 1 on ONTICK?

Shift (as far as it is used in the SDK) can be used to get an indicator value for a previous candle, as describd in this wiki page.
Or it can be used to get a previous candle, by calling getBar().
Or to get a previous tick, by calling getTick().
There is no such thing, like Shift in onTick() and/or onCandle(). Or at least not in the JForex SDK/strategy/non-visual api...
Quote:
With ONTICK using a Shift = 1, that is looking at the previous candle's specified period, usually the CLOSE.

Again here, you refer to ONTICK's Shift. Is this a Visual JForex thing?
Quote:
ONCANDLE looks at the CLOSE of the current and previous candles and compares the two?

onCandle() (again from the SDK point of view), is a function that is being called in a strategy whenever a candle is ready within the subscribed instruments. It doesn't compare anything, it is up to the strategy to do such thing.

About where to check for MA crossover (tick or candle creation):
I would say it is sufficient to 'act' within every candle creation, so use the onCandle() function to discover the cross, and act (submit order, for example). Of course there are situations when you want to react on every price change, not just only when a candle was drawn. But mostly the cross discovery can be properly handled during candle creation.


I hope I made some help with these words. Don't hesitate to reply, and let's make things clear for you.


 
 Post subject: Re: EMA Crossover and Opening/Closing Positions on MTF Post rating: 0   New post Posted: Wed 14 Oct, 2015, 11:48 

User rating: 1
Joined: Mon 01 Sep, 2014, 13:39
Posts: 34
Location: AustraliaAustralia
Thanks tcsabina,

Sorry for the late reply. I had computer problems which needed to be solved and I forgot about this thread. I think I understand now. I have written a Visual JForex strategy which I shall continue to test after I get a new demo account as the other one lapsed. I wish you could call and reinstate them instead of having toi create a new account all the time.

Cheers,
Chrysos.


 

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