Max position size

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #72107 quote
    bezieh
    Participant
    Average

    Hey!

    If i got defparam = false, and i got my bot to take a few trades in a row before selling, and i put the max position size to lets say 2, before i start the bot.

    after the bot bought 2, and it wants to buy again, does it shut down? or will it keep running, until the 1 or 2 is sold, to be able to buy again? 🙂

    #72116 quote
    Despair
    Blocked
    Master

    Defparam = false will give you an error. I assume that you mean cumulate orders = false. If this is false your strategy will only buy 1 time (in one direction) as long as you don’t try to buy more than 2 contracts. The strategy will not stop but simply ignore all orders.

    #72137 quote
    bezieh
    Participant
    Average

    thanks for the reply, can i backtest with cumulate orders max 2 or 3 somehow? so i can see what to expect?

    because sometimes the strategy did 5 orders and gave a big drawdown, and i want it to take max 2 trades for example, and see it in backtest 🙂

    #72138 quote
    Despair
    Blocked
    Master

    Sure, just set cumulateorders=true and then put an if condition in front of your order to only execute if countofposition<3 or what you desire.

    #72141 quote
    bezieh
    Participant
    Average

    i put “BUY if countofposition<3 and in backtest, it still buys more than 3 in a row, why?

    #72143 quote
    Despair
    Blocked
    Master

    Impossible to say without seeing your code.

    #72164 quote
    Despair
    Blocked
    Master

    I don’t know if you found your bug, but I remembered that countofposition will return a negative value for short positions. Having abs(countofposition<3) in the if-loop will fix this. Without this addition the strategy will accumulate short positions without stop.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Max position size


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
bezieh @bezieh Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Despair
7 years, 8 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 06/03/2018
Status: Active
Attachments: No files
Logo Logo
Loading...