[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: [amibroker] Using Bid Ask in RT trading



PureBytes Links

Trading Reference Links

Title: Re[2]: [amibroker] Using Bid Ask in RT trading

Thank you, I'll try that. Below I'll copy some Bid/Ask plotting code that will work regardless of the TimeFrame you are using. Of course you need RT data from IB or eSignal. 


any other suggestions anyone?,

herman


// RT Bid Ask chart


function TickArray2( Ticker, TickPriceName, NumTicks, Reset )

{

    Tickprice = GetRTDataForeign( TickPriceName, "AAPL" );

    InIndicator = Status( "Action" ) == 1;

    LQ = Nz( StaticVarGet( "Tick" + 0 ) );

    StaticVarSet( "LastQuotePrice", TickPrice );


    if ( TickPrice != LQ AND InIndicator )                                         // if new price add Tick to array

    {

        TA = Null;                                                                                         // Clear Output array

        NumTicks = Min( BarCount - 2, NumTicks );         // Stay in array size


        for ( n = NumTicks; n >= 0; n-- )

        {

            T = StaticVarGet( TickPriceName + ( n - 1 ) );

            StaticVarSet( TickPriceName + n, T );

            TA[ BarCount - 1 - n] = T;         // Fill return array

        }


        StaticVarSet( TickPriceName + 0, TickPrice );


        TA[BarCount-1] = TickPrice;

    }

    else

    {

        TA = Null;                                                                                         // Clear Output array

        NumTicks = Min( BarCount - 2, NumTicks );         // Stay in array size


        for ( n = NumTicks; n >= 0; n-- )

        {

            T = StaticVarGet( TickPriceName + n );

            TA[ BarCount - 1 - n] = T;         // Fill return array

        }

    }


    return TA;

}


function TickArraysReset( TickPriceName )

{

    global NumTicks;

    StaticVarSet( "Init"+TickPricename, 1 );


    for ( n = NumTicks; n >= 0; n-- ) StaticVarRemove( TickPriceName  + n );

}



GraphXSpace = 20;

TickerName = Name();

Clear                = ParamTrigger( "Clear Tick Charts", "CLEAR" );

NumTicks        = Param( "Tick-Array Length", 20, 3, 1000, 1 );


TickPriceName = "Last";

if ( IsNull( StaticVarGet( "Init"+TickPriceName ) ) OR Clear ) TickArraysReset( TickPriceName );

TA = TickArray2( TickerName, TickPriceName, NumTicks, Clear);

Plot( TA, TickPriceName, 1, 1);


TickPriceName = "Bid";

if ( IsNull( StaticVarGet( "Init"+TickPriceName ) ) OR Clear ) TickArraysReset( TickPriceName );

TA = TickArray2( TickerName, TickPriceName, NumTicks, Clear);

Plot( TA, TickPriceName, 4, 1);


TickPriceName = "Ask";

if ( IsNull( StaticVarGet( "Init"+TickPriceName ) ) OR Clear ) TickArraysReset( TickPriceName );

TA = TickArray2( TickerName, TickPriceName, NumTicks, Clear);

Plot( TA, TickPriceName, 5, 1);


Friday, January 30, 2009, 8:34:10 AM, you wrote:


>

Herman,

I am using:

StaticVarSet"bidRT"GetRTData"Bid" ) );

StaticVarSet"askRT"GetRTData"Ask" ) );

bidRT = StaticVarGet"bidRT" );

askRT = StaticVarGet"askRT" );

 

Then I buy (through ibc) at a limit price of lastvalue(askRT) or short at the lastvalue(bidRT) limit price.

It almost always executes immediately, in fact, I can’t recall missing an execution although there may have been a few.

 

I have played around a little bit with shaving off a ticksize or two, but then in a fast market, you miss the trade.  And how do you know when the market is going to take off?

I have used this mainly in trading the futures on my paper account with IB, though it should work with stocks as well.

I really like the idea of using limit orders instead of market orders.

 

Best regards,

Grover

 

 

 

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman

Sent: Friday, January 30, 2009 3:25 AM

To: AmiBroker User Group

Subject: [amibroker] Using Bid Ask in RT trading

 

Would anyone have coded rules on using Bid Ask prices to improve trade execution?

 

Is it worth the effort?

 

ideas and/or links would be appreciated,

 

herman

 

 

 

__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___