Efficiency on exit position

Posted By: tradingest

Efficiency on exit position - 11/08/18 12:37

Hi guys,

my function run() is execute on BarPeriod = 1.
Each minute the function check my gain or loss and when reach a value exit on position.
I want ot guarantee that the value.

For istance: target value = 120

1 run --> value 100
2 run --> 119
3 run --> 80

but between 2 and 4 run has reached 140.How can I exit before without change the BarPeriod = 1. Is it possible?

Thanks
Posted By: Dalla

Re: Efficiency on exit position - 11/08/18 14:36

Use a TMF. It will be executed on every tick.
http://zorro-project.com/manual/en/trade.htm
Posted By: AndrewAMD

Re: Efficiency on exit position - 11/08/18 14:36

A TMF runs on every tick. You can simulate it using the TICKS flag.

Or you can put your exit logic in tick().

Read these:
http://zorro-project.com/manual/en/trade.htm
http://zorro-project.com/manual/en/mode.htm#ticks
http://zorro-project.com/manual/en/tick.htm
Posted By: tradingest

Re: Efficiency on exit position - 11/08/18 16:17

thanks so much AndrewAMD

so, this means that also my strategy run each 1 min I can exit each tick with TMF function?
Posted By: Dalla

Re: Efficiency on exit position - 11/08/18 16:21

As long as you get tick data from your broker, yes
Posted By: tradingest

Re: Efficiency on exit position - 11/08/18 19:13

thanks so much for the support.

TMF working with tick I guess that this functions works in live trading and is not possible to test. Is it correct?
Posted By: AndrewAMD

Re: Efficiency on exit position - 11/08/18 19:33

Use the TICKS flag.
Posted By: tradingest

Re: Efficiency on exit position - 11/08/18 19:36

Originally Posted By: AndrewAMD
Use the TICKS flag.


So, with flag works also within backtest?

I insert the flag in the function run(), is it correct?
Code:
set(TICKS);



fantastic!!

thanks again
Posted By: Dalla

Re: Efficiency on exit position - 11/08/18 22:10

For backtesting the same applies as above. If you have tick data (T1 files) and set TICKS flag), then the tmf will run on every tick.
Posted By: tradingest

Re: Efficiency on exit position - 11/09/18 18:44

Hi Dalla,

thank for your support. I try to set set(TICKS) but in real when the position reach the amount that I want the position doesn't close.

Why? What I miss?

I setting the TICKS in function run() with BarPeriod = 1.

Can you help me with an example or with the code that I must write in my script?
Posted By: Dalla

Re: Efficiency on exit position - 11/09/18 19:38

When I think about it, you should be able to do what you want using TakeProfit, without a tmf.
Check here http://www.zorro-trader.com/manual/en/barperiod.htm
Posted By: tradingest

Re: Efficiency on exit position - 11/09/18 20:51

Hi Dalla,

but I want use BarPeriod = 1 but exit when the condition is verified.
Can you help me?
Posted By: Dalla

Re: Efficiency on exit position - 11/10/18 08:04

TakeProfit is evaluated on every tick
Posted By: tradingest

Re: Efficiency on exit position - 11/10/18 08:50

Originally Posted By: Dalla
TakeProfit is evaluated on every tick


Under function tick() otherwise doesn't work for each tick under funcion run() 1 min
Posted By: Dalla

Re: Efficiency on exit position - 11/11/18 04:20

Pretty sure it works under the run() function as well, given that you set the TICKS flag as mentioned earlier in this thread
Posted By: tradingest

Re: Efficiency on exit position - 11/11/18 10:49

I'm testing il live and like you said doesn't works.
It works well under function tick()
Posted By: Dalla

Re: Efficiency on exit position - 11/12/18 15:41

You should probably put it in a TMF then.
© 2024 lite-C Forums