Limit level trailing

Strategies are published here.

Moderator: admin

Limit level trailing

Postby Alexander.Gettinger » Tue Jun 05, 2012 3:21 pm

The strategy for take profit trailing.

User can define limit level and trailing step.

Download:
Trailing_Limit.lua
(6.73 KiB) Downloaded 1439 times

Trailing_Limit_All.lua
(8.03 KiB) Downloaded 652 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Limit level trailing

Postby peterpap » Mon Jun 03, 2013 12:51 pm

Nice idea!
It works with all the orders for the selected pair!
But I would like a limit order to be more dynamic moving back and forward ready to close your position with max profits or less losses.
I tried to connect the limit order with a parameter like the Fractal. So I made a limit order stradegy which follows the Up Fractal with limit order going up and down (if you wish) similar to FractalStop stradegy which follows the Down Fractal.
I think that I' m gonna be rich!!!

Best Regards
peterpap
 
Posts: 3
Joined: Sun Jun 02, 2013 11:25 am

Re: Limit level trailing

Postby LordTwig » Sat Nov 02, 2013 9:27 pm

Why not just add this 'Trailing Limit' and 'Trailing Step' features CODE to the lua codebase instead and like totally uncomplicate it. :roll:

Then there is no reason to have this whole strategy to do this simple task.

So this would work for LIMITS ........
Code: Select all
    strategy.parameters:addBoolean("SetLimit", "Set Limit Orders", "", true);
    strategy.parameters:addInteger("Limit", "Limit Order in pips", "", 1000, 1, 10000);
    strategy.parameters:addBoolean("TrailingLimit", "Trailing Limit order", "", false);
    strategy.parameters:addInteger("TrailingLimitStep", "Trailing Limit step", "", 1, 1, 500);
.....
        SetLimit = instance.parameters.SetLimit;
        Limit = instance.parameters.Limit;
        TrailingLimit = instance.parameters.TrailingLimit;
        TrailingLimitStep = instance.parameters.TrailingLimitStep;
.....
   -- Create limit order using specified pip offset
   if SetLimit then
      valuemap.PegTypeLimit = "O";
      if BuySell == "B" then
         valuemap.PegPriceOffsetPipsLimit = Limit;
      else
         valuemap.PegPriceOffsetPipsLimit = -Limit;
      end
      if TrailingLimit then
         valuemap.TrailStepLimit = TrailingLimitStep;
      end
   end



Just as this does for STOPS .....
Code: Select all
 strategy.parameters:addBoolean("SetStop", "Set Stop Orders", "", true);
    strategy.parameters:addInteger("Stop", "Stop Order in pips", "", 100, 1, 10000);
    strategy.parameters:addBoolean("TrailingStop", "Trailing stop order", "", false);
    strategy.parameters:addInteger("TrailingStopStep", "Trailing stop step", "", 1, 1, 500);
.....
        SetStop = instance.parameters.SetStop;
        Stop = instance.parameters.Stop;
        TrailingStop = instance.parameters.TrailingStop;
        TrailingStopStep = instance.parameters.TrailingStopStep;

.....
    -- Create stop order using specified pip offset
   if SetStop then
      valuemap.PegTypeStop = "O";
      if BuySell == "B" then
         valuemap.PegPriceOffsetPipsStop = -Stop;
      else
         valuemap.PegPriceOffsetPipsStop = Stop;
      end
      if TrailingStop then
         valuemap.TrailStepStop = TrailingStopStep;
      end
   end


So as long as they added to the LUA CODE BASE they are easy to implement...... in the same way as are the Stops.
Please implement this..... :idea:
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Limit level trailing

Postby LordTwig » Sun May 04, 2014 1:04 am

Has this been implemented into lua codebase yet?
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Limit level trailing

Postby LordTwig » Tue Sep 09, 2014 11:42 pm

So can this be done??
Can it be added to the lua codebase?
If so why not do it?
Aren't we after simpler rather than complicated?

Cheers
Lordtwig
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Limit level trailing

Postby Apprentice » Sun Dec 11, 2016 6:24 am

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

Re: Limit level trailing

Postby conjure » Sun Jul 22, 2018 8:04 am

this is almost what i need.
Except one thing.
is it possible for the strategy to automatically search and find LimitLevel
for every new trade that opens?
and trail as it does?
even if i move the limit manual after position has opened?
conjure
FXCodeBase: Initiate
 
Posts: 135
Joined: Sat Jul 22, 2017 7:27 am

Re: Limit level trailing

Postby Apprentice » Sat Aug 04, 2018 6:52 am

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



Return to Custom Strategies

Who is online

Users browsing this forum: No registered users and 22 guests