Problem to exit position - because not at he end of turn

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

Problem to exit position - because not at he end of turn

Postby william17 » Tue Sep 17, 2019 8:46 am

Hello,

I need help please,

Im using a strategy who works with MACD to exit position.
You can see it in attached file.

My problem is that the algorithm not calculate the position output at the end of the period: if there is a wick during candle ans the position exit signal is here, it doesn't recalculate at the end of turn
And if at the end of turn, there is no signal to exit position, it close the order still !!

For information, in this strategy, i want the MACD close order when the slope is different from the order opening

Someone could help me please,

Thank you
Attachments
Aroon up.lua
Strategy
(28.84 KiB) Downloaded 26 times
william17
 
Posts: 50
Joined: Wed Feb 08, 2017 9:24 am

Re: Problem to exit position - because not at he end of turn

Postby Apprentice » Wed Sep 18, 2019 6:52 am

Your request is added to the development list.
Development reference 107.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 22996
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Re: Problem to exit position - because not at he end of turn

Postby william17 » Thu Oct 10, 2019 7:44 am

Hello Apprentice,

Thank you for your reply, but unfortunately, it dosen't going well…
Indeed, it calculate only during candle, and not at the end of turn…

It is possible to use the following function :

function CreateTradingParameters

strategy.parameters:addString("ExecutionType", "End of Turn / Live", "", "End of Turn")
strategy.parameters:addStringAlternative("ExecutionType", "End of Turn", "", "End of Turn")
strategy.parameters:addStringAlternative("ExecutionType", "Live", "", "Live"

With this trading parameters, we should have the signal only at the end of the candle, isn't it?
william17
 
Posts: 50
Joined: Wed Feb 08, 2017 9:24 am

Re: Problem to exit position - because not at he end of turn

Postby Apprentice » Thu Oct 10, 2019 12:33 pm

Your request is added to the development list.
Development reference 176.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 22996
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Re: Problem to exit position - because not at he end of turn

Postby william17 » Fri Oct 18, 2019 3:45 am

Hello Apprentice,

Thank you for your reply,

But there is a problem…
For open position, apparently and for the moment no problem, but for close position, it's getting a candle to late!!
So when we have the exit signal, the position close one candle later!
And more, the signal generated must be < or > and not ≤ or ≥

Have you an idea?
william17
 
Posts: 50
Joined: Wed Feb 08, 2017 9:24 am

Re: Problem to exit position - because not at he end of turn

Postby Apprentice » Mon Oct 21, 2019 5:25 am

To get faster exit you need to use "Live" mode
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 22996
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Problem to exit position - because not at he end of turn

Postby william17 » Tue Oct 29, 2019 1:36 pm

Thank you!
It works well…

And i like your version, because there are différent options and it looks complete

I have some changes to make, if it's possible,

I would like to work on the following idea,

indicators : Ichimoku, RSI, ADX, SAR, MACD,

For buy:
Open buy when SAR UP change to SAR DOWN and,
If the price close current is > SA (-26) and SB (-26)
If the RSI n-1 is lower of level 50 (with adjustable value)

Close buy if MACD n-1 is > MACD current, or if RSI is ≧ 70 (with adjustable value)


Idem for sell:
Open sell when SAR DOWN change to SAR UP and,
If the price close current is < SA (-26) and SB (-26)
If the RSI n-1 is upper of level 50 (with adjustable value)

Close sell if MACD n-1 is < MACD current, or if RSI is ≤ 30 (with adjustable value)


Small precision, if i want to use this strategy on 2 timeframes, (H1 and 15mn)
if i have a signal to close a position in 15 mn, can it close only the position on 15 mn and not on H1 (if a position is open too on H1)?

Thank you for your help
william17
 
Posts: 50
Joined: Wed Feb 08, 2017 9:24 am

Re: Problem to exit position - because not at he end of turn

Postby Apprentice » Wed Oct 30, 2019 5:48 am

Your request is added to the development list.
Development reference 262.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 22996
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Next

Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 7 guests