Tradestation: a Basic Crossover Strategy

Discussion in 'Automated Trading' started by Nashequilibrium, Oct 3, 2006.

  1. I am hoping that someone could help, i have programmed a basic crossover strategy, but the easy language code, only buys and sells on the close of the bar where the crossover occured instead of on the open. This results in valuable points/profits been lossed. Does anyone have an idea if you could code the tradestation program to buy on the open of the bar where the crossover occurs?

    Thanks
     
  2. What does your code say? buy on open or close?
     
  3. If you buy at the open, wouldn't you be buying before the crossover occurred? You would be looking into the future. I believe you can "buy this bar at close" or "next bar on open", but not "this bar on open".
     
  4. twalker

    twalker

    You can buy/sell intrabar using stop orders or using the inbuilt
    [intrabarorderpersist = true] function.
     
  5. If you want to buy the second the crossover occurs, you need to calculate at what price the crossover will occur, then put in an order ahead of time. This is much more accurate than trying to use Tradestations intrabar order generation
     
  6. Just to be clear.........when using candlesticks, the crossover will always occur when the next candle stick opens, therefore i would like tradestation to enter into the trade at the open of the bar where the crossover occurs. I am not looking to trade this yet, i am still backtesting it, so in the backtest results, i would like to see what happens when you bar at the open of the candlestick. From what i have researched, tradestation only allows the order to be generated at the close of the candlestick where the crossover occured or the open of the next bar. I am hoping that there is a way around this.

    As this does not make sense, for a charting package that promotes automated trading to not have taken the time to put in such a simple feature. It also makes me wonder if everyone else just waits to buy/sell at the close of the bar where their signal was generated or the next bar open??
     
  7. twalker

    twalker

    This is not the case. Just use following syntaxc in EL

    if {condition} then buy {x} contracts next bar on Open;

    this will work even without intrabarpersist.

    The main commands you will require are

    if {condition} then buy {x} contracts this bar on close;
    if {condition} then buy {x} contracts next bar at {level} on stop;
    if {condition{} then buy {x} contracts next bar at {level} limit;

    Hope this is some help.

    Pro trader - not sure what you mean.
     
  8. I misunderstood what he was looking for. I was talking about calculating what price the crossover will occur ahead of time.
     
  9. Thanks for the help. The code below is a good examle of my issue. Why can't i do this:

    if {condition} then buy {x} contracts this bar on open;

    The only options available in EL is:
    This bar on close, next bar at...

    Why can't i buy at the open of the bar where the crossover occurs??


    This is not the case. Just use following syntaxc in EL

    if {condition} then buy {x} contracts next bar on Open;

    this will work even without intrabarpersist.

    The main commands you will require are

    if {condition} then buy {x} contracts this bar on close;
    if {condition} then buy {x} contracts next bar at {level} on stop;
    if {condition{} then buy {x} contracts next bar at {level} limit;

    Hope this is some help.

    Pro trader - not sure what you mean.
     
  10. We have to be a bit careful here because in order for something to be bought on bar open, you would have to have an open that is part of your condition. In otherwords, your statement is really saying buy the OPEN if the OPEN is a crossover. Otherwise, you cannot buy the open on information that becomes available after the open... SO in a sense, you are talking about the cases where the open price is actually the crosover point which then just leads back to the precondition of knowing what price would trigger the crossover position before the actual price is reached...
     
    #10     Oct 4, 2006