Announcement

Collapse
No announcement yet.

Why Does My Sell Limit Generate At Random Price Levels?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why Does My Sell Limit Generate At Random Price Levels?

    Hi everyone, I'm having a bit of trouble getting an accurate placement of my automated sell limit and I hoping someone can identify the source of my problem.

    The issue is specifically this: When my sell limit generates, the target amount is usually off by between 0.01 to 0.03 cents.

    So for example, if I buy at $10.00, and the program is supposed to set a 0.03 point target for $10.03, the program erroneously generates the sell limit anywhere between 10.01 and over.

    Here's a brief example of the problem:

    PHP Code:
    function preMain(){
        
    //some options
    }


    function 
    main(some preMain variables){
        
    // Some actons
        // Wait conditions for entry

        
    if(conditions){
            
    SellLimitLevel getMostRecentAsk()+someValue//try to get ask value
            
    LimitOrderID Trade.sellLimit(SellLimitLevelgetSymbol()); // sell limit levels seem to have different values  with current ask + someValue - I think that this might be where the problem is.
        
    }


    In case it helps, here are some things I noticed while testing that might help shed light on the issue:

    1. The sell limit does (at times) target the correct price level (for example $10.03).
    2. The sell limit placement seems completely random (that is, never really commits the same erroneous price level twice in a row, such a 10.02, 10.02, etc.).

    Any help or a point in the right direction would really be appreciated.
    Last edited by VideCorEsig; 10-19-2016, 05:16 AM.

  • #2
    The getMostRecentAsk does not get the NEAREST ASK. It gets the LATEST ASK (which could be anywhere on the price scale). My advice would be to create a verification checker for the ASK level and determine if it is within n ticks of the current price. Like this

    PHP Code:

    var SellLimitLevel getMostRecentAsk();
    var 
    TickTolerance 2;
    var 
    CanContinue false;
    CanContinue = (Math.abs(SellLimitLevel close(0)) / getMinTick()) <= TickTolerance;

    if (
    CanContinue) {
        
    SellLimitLevel += SomeValue;
        
    LimitOrderID Trade.sellLimit(SellLimitLevelgetSymbol());

    TickTolerance

    Comment

    Working...
    X