MA Direction change Initial AllowedSide

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

MA Direction change Initial AllowedSide

Postby robbieyoung » Tue Nov 13, 2018 1:18 pm

The attached strategy will Buy if the MA changes direction and moves up and Sell if the MA changes direction and moves down.
The skipfirst logic ignores the first direction found when the strategy is started to force the strategy to wait until a change of direction has occurred before placing the first trade.


Please can you change the attached strategy in the following way:

Remove the logic relating to skipfirst and FIRST_DIRECTION.

Replace this with the ability to set the Initial AllowedSide to either BUY or SELL for the first trade direction (ie if no trades already exist for the selected currency).

Once the first trade has been made or if a trade already exists for the currency then the AllowedSide should automatically be set to BOTH.


NB
This needs to be currency specific as I have other strategies running on other currencies at the same time.

Also I know there may be other ways to achieve this but I really need it done as detailed above as I have other more complicated strategies which will also rely on the logic created here.

Many thanks for all your help.
Attachments
MA up or Down.lua
(21.98 KiB) Downloaded 379 times
robbieyoung
 
Posts: 32
Joined: Tue Apr 21, 2015 3:12 am

Re: MA Direction change Initial AllowedSide

Postby Apprentice » Wed Nov 14, 2018 4:36 pm

Your request is added to the development list under Id Number 4316
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: MA Direction change Initial AllowedSide

Postby Apprentice » Sat Nov 17, 2018 5:55 am

Try this version.
MA up or Down.lua
(23.04 KiB) Downloaded 381 times
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: MA Direction change Initial AllowedSide

Postby robbieyoung » Tue Nov 20, 2018 9:11 am

Thank you so much for this.

It seems to work perfectly well in back-testing.

I'll let you know if there is any difference when using it on live markets.

Thanks again.
robbieyoung
 
Posts: 32
Joined: Tue Apr 21, 2015 3:12 am


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 15 guests