Pause a strategy automatically

All posts which do not fit into any other sections of the forum.

Moderator: admin

Pause a strategy automatically

Postby Daveatt » Sun Dec 23, 2018 10:20 am

Hey guys

Is there a way to pause/kill a strategy instance using some LUA source code ? I'd like to get it paused when the daily loss is below a specific threshold

I'm looking for the command for doing so

Thanks
Daveatt
Daveatt
 
Posts: 62
Joined: Mon Jan 30, 2017 10:00 am

Re: Pause a strategy automatically

Postby Daveatt » Thu Dec 27, 2018 4:20 pm

Discovered randomly this thread viewtopic.php?f=22&t=56508&p=84846&hilit=ChangeParameters&sid=39878a5678b9577661af78dcde0053a1#p84846

As you can not turn strategy on and off as you want.
U have to prevent trade execution, during the periods
when it is not desired, from within strategy code.


This answers my question :)

Thanks
Daveatt
Daveatt
 
Posts: 62
Joined: Mon Jan 30, 2017 10:00 am

Re: Pause a strategy automatically

Postby Frustor » Fri Jan 18, 2019 8:54 am

Daveatt wrote:Discovered randomly this thread viewtopic.php?f=22&t=56508&p=84846&hilit=ChangeParameters&sid=39878a5678b9577661af78dcde0053a1#p84846

As you can not turn strategy on and off as you want.
U have to prevent trade execution, during the periods
when it is not desired, from within strategy code.


This answers my question :)

Thanks
Daveatt


Thank you! I had the same question!
Frustor
 
Posts: 1
Joined: Thu Jan 17, 2019 12:44 pm
Location: North Bergen

Re: Pause a strategy automatically

Postby Apprentice » Sun Jan 20, 2019 6:09 am

public method host:execute("stop");

Brief

Stops the strategy which executed the command

Declaration
Lua
core.host:execute ("stop")

Details

The command is useful for the strategies which works until some condition is met. For example until the chosen trade disappears. After such condition there is no reason to keep strategy working, so the strategy can stop itself.

Only strategies can use this command.

Declared in host
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Pause a strategy automatically

Postby Dim4ksan » Tue Feb 04, 2020 8:34 am

Apprentice wrote:public method host:execute("stop");

Brief

Stops the strategy which executed the command

Declaration
Lua
core.host:execute ("stop")

Details

The command is useful for the strategies which works until some condition is met. For example until the chosen trade disappears. After such condition there is no reason to keep strategy working, so the strategy can stop itself.

Only strategies can use this command.

Declared in host

Good, thank you.
Dim4ksan
 
Posts: 1
Joined: Tue Feb 04, 2020 8:32 am

Re: Pause a strategy automatically

Postby Peggasis » Mon Feb 17, 2020 11:53 am

Can you set more than one condition that stops a strategy when met?
Peggasis
 
Posts: 1
Joined: Tue Sep 20, 2016 3:41 am

Re: Pause a strategy automatically

Postby Apprentice » Tue Feb 18, 2020 8:57 am

Sure.
A single one, all or any of condition specified can trigger the stops.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests