How to recall/obtain prices from trades in tradestaion 2000i?

Discussion in 'Automated Trading' started by marcosr, Nov 5, 2005.

  1. marcosr

    marcosr

    I am running a backtest on a strategy applied to a chart on TS2000i. My stoploss acts as a trailing stop as the stoploss number gets 'refreshed' with each new bar.
    Is there a command I can use within Easylanguage to access the entry price at which the trades get done? i.e. the entry price as reported on the Strategy Performance Report.

    I have tried the command "entryprice" but it returns a zero!. Entryprice[1] returns the previous trade and Entryprice[0] returns again zero!. To properly place a stoploss I need to get the correct entry price for each trade. It must be stored somewhere....

    Any help is most appreciated, I have spent already a number of nights on this with no success.

    Thx

    Marcos
     
  2. “Is there a command I can use within Easylanguage to access the entry price at which the trades get done?”

    Yes. It’s EntryPrice(0). It is available on the next bar AFTER the trade is made, not on the bar that you place the order. You can issue a stop loss prior to the trade based on something other than EntryPrice (e.g., Low of last bar), and then after the trade is executed you can change the stop loss to a value based on EntryPrice.

    To see this try:

    var: MtkPos(0), Signal(0), xEntryPrice(0);

    Signal = {1 if issued order to go long on this bar, -1 if going short, 0 otherwise};
    MtkPos = MarketPosition;
    xEntryPrice(0);
    print(Date, Time, O, H, L, C, Signal, MtkPos, xEntryPrice);

    Then look at the debug tab of the PowerEditor. You will see that one bar after you issue an order (Signal) that MtkPos and xEntryPrice change if the order was completed; and EntryPrice is not 0.
     

  3. I don't understand your question very well, Can you post
    part of your exit rules here?

    Also did you use [0] or (0) for entryprice? Did you try somthing like:
    Exitlong from entry ("name") at highest(high, xx)- x.xxpoint stop;
     
  4. marcosr

    marcosr

    Wolfvector,
    I do now see clearly what you mean. Ran it and saw it on the Debug window, I can now move forward. Thx again!.

    Nana,
    I am now using the lines below. It works fine with the only exception that the first trade is always stopped (as a result of what Wolfvector explained). I will change entryprice(1) to close or open instead. Unless there is some other way to get the entryprice value on the same bar as the stoploss execution bar.

    Inputs: hardstop(0);
    {Hard Stop}
    setstopcontract;
    setstoploss(entryprice(1)*hardstop)


    Thx again.

    Marcos