Introduce a delay in a Strategy

Discussion in 'Automated Trading' started by gramme, Feb 26, 2008.

  1. gramme

    gramme

    Hello,
    I trade with a 1min chart, I use TS2000i and Braket trader to send the order to my broker. I generate a text file from TS2000i that Braket trader read every 200msecond.

    I would like to introduce a delay of about 250ms-300ms, between to order generated by the same condition to reverve my position when I am already in a position.
    Because my problem is that the two line generated in the text file have the same time stamp.
    I do not want to modify the time stamp, I only want to introduce a delay at the location indicated below before TS2000 write the second order to enable Braket Trader to manage the first order and then the second instead of ignore the first one.
    Can you please if it is possible to create a counter or a loop which count 250ms.

    Thaks you for your help. And please find below the code.


    if Condition1 then
    if Condition2 then
    if MarketPosition=-1 {to test if I am already Short} then
    begin

    {I generate the file to exit from my current position}

    FileAppend("C:\BracketTrader\Signals\Entries.txt", "cxlplace,BUY,1,MKT,,0,20"+RightStr(numtostr(D,0), 6)+numtostr(Time-1,0)+"0,EXIT"+ NewLine);

    Buy ( "jup2" ) next bar at close-vale Limit;

    {LOCATION WHERE I WANT TO INTRODUCE A DELAY OF ABOUT 250ms BEFORE TO GENERATE THE ORDER TO ENTER IN THE NEW DIRECTION}

    FileAppend("C:\BracketTrader\Signals\Entries.txt", "cxlplace,BUY,1,LMT,"+numtostr((Close-vale),2)+",0,20"+RightStr(numtostr(D,0),6)+numtost r(Time,0)+"0,ENTRY"+ NewLine);

    end;