Page 6 of 7

Re: Breakeven Strategy

PostPosted: Tue Sep 08, 2015 2:16 pm
by zoltanh
Hi,
Could you check for me the attached why it can give me 'Failed create stop The Rate must be a positive number.' message? (Not sure this is the only problem)
I wanted to add 5 additinal breakeven level - so running strategies on 9 currency pairs, I dont have to set up 54 strategies with 'BreakevenAll' (6 for each) just 9.
My intention is setting breakeven levels not with the trailing function but with my levels keeping the same 'Gap'
thanks in advance!

Re: Breakeven Strategy

PostPosted: Mon Oct 26, 2015 10:54 am
by kmason
Would the breakeven strategy work for FIFO accounts if the strategy could be instructed to monitor open positions on a certain pair only?

i.e. Use a different version of the strategy for NZD/USD than for NZD/JPY (breakeven-nzd-usd.lua and breakeven-nzd-jpy.lua) and then give each strategy a custom identifier.

My needs aren’t as complex as some of the posters on the board. I do not open multiple positions for the same pair. I simply want a script capable of moving an existing stop loss to breakeven (or 1 pip profit actually) when the trade reaches 21 pips in profit.

Is it even possible to move an existing stop on a FIFO account? It is not a hedging account.

Re: Breakeven Strategy

PostPosted: Tue Oct 27, 2015 4:17 am
by Apprentice
Would the breakeven strategy work for FIFO accounts if the strategy ...
Sure. As it is it is not currency sensitive.

Re: Breakeven Strategy

PostPosted: Fri Nov 25, 2016 11:21 am
by efh123
4x4partners wrote:In reference to my above issue regarding BREAKEVENALL:

I modified a few lines in ExtUpdate in order to check to see if the current stop is better than breakeven. Seems to work.

If anyone wants the code, I've pasted it below.

Basically replace these 5 lines:

Code: Select all
           if (tradeRow.IsBuy) then
                stopValue = openPrice + (gap * instance.bid:pipSize());
            elseif (not tradeRow.IsBuy) then
                stopValue = openPrice - (gap * instance.bid:pipSize());
            end



With the below, which adds the additional check:

Code: Select all
           if (tradeRow.IsBuy) then
                stopValue = openPrice + (gap * instance.bid:pipSize());

            -- check if the stop is better than the BreakEven level, if so, do nothing and exit
                    if stopValue < tradeRow.Stop then
                        return;
                    end

            elseif (not tradeRow.IsBuy) then
                stopValue = openPrice - (gap * instance.bid:pipSize());

            -- check if the stop is better than the BreakEven level, if so, do nothing and exit
                    if stopValue > tradeRow.Stop then
                        return;
                    end
            end


hello there,

thank you very much for the code.
i seached long time for this through the net.
but i have one problem.

if i insert this in my script it works fine for long trades.
but not for short.

the strategy doesnt set a stop.
i edit a little bit the code but nothing worked.
can someone please help me?

best regards
lux

Re: Breakeven Strategy

PostPosted: Tue Nov 29, 2016 6:59 pm
by efh123
ok i found out, that i have to set a worser stop in short order. so the strategy edit it to my wish.
buy orders are set from strategy although there is no stop order set at the beginning.

example: if i want to have a stop set bey strategy for 5P - i have to place a short order with stop 20p
and the strategy will edit it to 5p in a sec. if i leave it empty, the strategy will not work.

also becarefull if you have a better stop in 1 position set. if you have more trades open,
the whole strategy will stop. (breakevenall).

so its nice but not perfect.

Re: Breakeven Strategy

PostPosted: Sun Dec 18, 2016 9:32 am
by Apprentice
Strategy was revised and updated.

Re: Breakeven Strategy

PostPosted: Mon Oct 23, 2017 3:30 pm
by Cactus
moomoofx wrote:"Net Stop" mode such that it sets the stops on all trades to be the net break-even --- added to the to-do list.

Cheers,
MooMooForex


Has this ever been developed?
A "BreakevenALL" but for net positions (average of all positions for breakeven)

Re: Breakeven Strategy

PostPosted: Thu Mar 22, 2018 10:16 pm
by Reymondpolanco
Im getting this error

Re: Breakeven Strategy

PostPosted: Tue Mar 27, 2018 10:29 am
by Apprentice
Try this version.
Breakeven Strategy.lua
(42.92 KiB) Downloaded 1070 times

Re: Breakeven Strategy

PostPosted: Wed May 09, 2018 10:08 am
by Reymondpolanco
Can you put the option to put an specific price level and pips too