Breakeven Strategy

Strategies are published here.

Moderator: admin

Re: Breakeven Strategy

Postby zoltanh » Tue Sep 08, 2015 2:16 pm

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!
Attachments
6BreakevenAll.lua
(16.15 KiB) Downloaded 208 times
zoltanh
 
Posts: 22
Joined: Tue Aug 26, 2014 2:24 pm

Re: Breakeven Strategy

Postby kmason » Mon Oct 26, 2015 10:54 am

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.
kmason
 
Posts: 2
Joined: Mon Oct 26, 2015 10:44 am

Re: Breakeven Strategy

Postby Apprentice » Tue Oct 27, 2015 4:17 am

Would the breakeven strategy work for FIFO accounts if the strategy ...
Sure. As it is it is not currency sensitive.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17407
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Breakeven Strategy

Postby efh123 » Fri Nov 25, 2016 11:21 am

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
efh123
 
Posts: 8
Joined: Fri Nov 25, 2016 9:56 am

Re: Breakeven Strategy

Postby efh123 » Tue Nov 29, 2016 6:59 pm

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.
efh123
 
Posts: 8
Joined: Fri Nov 25, 2016 9:56 am

Re: Breakeven Strategy

Postby Apprentice » Sun Dec 18, 2016 9:32 am

Strategy was revised and updated.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 17407
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Breakeven Strategy

Postby Cactus » Mon Oct 23, 2017 3:30 pm

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)
Never chase the money, let the money come to me
User avatar
Cactus
FXCodeBase: Graduate
 
Posts: 213
Joined: Fri Feb 19, 2016 11:46 am
Location: Errywhere

Previous

Return to Custom Strategies

Who is online

Users browsing this forum: No registered users and 4 guests