i am not seeing any cursor with that code, Herman.
Maybe someone can explain the following. First example: I stay in pixel mode. Since GfxSetCoordsMode( 0 ); is the default I will not call it at all. I just play with the ZOrder. In this case I place the cursor behind the price. This works as I would expect it would work.
GfxSetBkMode( 1 ); // set transparent mode
RequestMouseMoveRefresh();
// Price /////////////////////////////////////////////////////
ZOrderPrice = Param( "Z-Order Price", 0, -10, 10, 1 );
Plot( C, "C", colorWhite, styleCandle, Null, Null, 0, ZOrderPrice, 1 );
// Price /////////////////////////////////////////////////////
// Circle /////////////////////////////////////////////////////
ZOrderCircle = Param( "Z-Order Circle", -1, -10, 10, 1 );
GfxSetZOrder( ZOrderCircle );
x = GetCursorXPosition( 1 );
y = GetCursorYPosition( 1 );
GfxSelectSolidBrush( ColorRGB( 128, 255, 255 ) );
GfxSelectPen( ColorRGB( 0, 255, 255 ), 1 );
GfxCircle( x, y, 30 );
// Circle /////////////////////////////////////////////////////
Now I add the VWAP. For the VWAP I need to use the "bar/price" mode. But since I call this at the bottom of the code I can leave the code I posted above unchanged (in my mind at least). So then I would get:
GfxSetBkMode( 1 ); // set transparent mode
RequestMouseMoveRefresh();
// Price /////////////////////////////////////////////////////
ZOrderPrice = Param( "Z-Order Price", 0, -10, 10, 1 );
Plot( C, "C", colorWhite, styleCandle, Null, Null, 0, ZOrderPrice, 1 );
// Price /////////////////////////////////////////////////////
// Circle /////////////////////////////////////////////////////
ZOrderCircle = Param( "Z-Order Circle", -1, -10, 10, 1 );
GfxSetZOrder( ZOrderCircle );
x = GetCursorXPosition( 1 );
y = GetCursorYPosition( 1 );
GfxSelectSolidBrush( ColorRGB( 128, 255, 255 ) );
GfxSelectPen( ColorRGB( 0, 255, 255 ), 1 );
GfxCircle( x, y, 30 );
// Circle /////////////////////////////////////////////////////
// VWAP /////////////////////////////////////////////////////
ZorderVAP = Param( "Z-Order VAP", -2, -10, 10, 1 );
GfxSetZOrder( ZorderVAP );
GfxSetCoordsMode( 1 ); // bar/price mode
bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );
mx = PriceVolDistribution( H, L, V, 100, False, fvb, lvb );
bins = MxGetSize( mx, 0 );
GfxSelectPen( ColorRGB( 255, 128, 255 ), 1 );
for( i = 0; i < bins; i++ )
{
price = mx[ i ][ 0 ]; // price level
relvolume = mx[ i ][ 1 ]; // relative volume 0..1
relbar = relvolume * ( lvb - fvb + 1 );
GfxMoveTo( fvb, price );
GfxLineTo( fvb + relbar, price );
}
// VWAP /////////////////////////////////////////////////////
However, now the cursor will not be visible. To make it visible I need to add GfxSetCoordsMode( 0 ); as follows:
GfxSetBkMode( 1 ); // set transparent mode
RequestMouseMoveRefresh();
// Price /////////////////////////////////////////////////////
ZOrderPrice = Param( "Z-Order Price", 0, -10, 10, 1 );
Plot( C, "C", colorWhite, styleCandle, Null, Null, 0, ZOrderPrice, 1 );
// Price /////////////////////////////////////////////////////
// Circle /////////////////////////////////////////////////////
ZOrderCircle = Param( "Z-Order Circle", -1, -10, 10, 1 );
GfxSetZOrder( ZOrderCircle );
GfxSetCoordsMode( 0 ); // pixel mode
x = GetCursorXPosition( 1 );
y = GetCursorYPosition( 1 );
GfxSelectSolidBrush( ColorRGB( 128, 255, 255 ) );
GfxSelectPen( ColorRGB( 0, 255, 255 ), 1 );
GfxCircle( x, y, 30 );
// Circle /////////////////////////////////////////////////////
// VWAP /////////////////////////////////////////////////////
ZorderVAP = Param( "Z-Order VAP", -2, -10, 10, 1 );
GfxSetZOrder( ZorderVAP );
GfxSetCoordsMode( 1 ); // bar/price mode
bi = BarIndex();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );
mx = PriceVolDistribution( H, L, V, 100, False, fvb, lvb );
bins = MxGetSize( mx, 0 );
GfxSelectPen( ColorRGB( 255, 128, 255 ), 1 );
for( i = 0; i < bins; i++ )
{
price = mx[ i ][ 0 ]; // price level
relvolume = mx[ i ][ 1 ]; // relative volume 0..1
relbar = relvolume * ( lvb - fvb + 1 );
GfxMoveTo( fvb, price );
GfxLineTo( fvb + relbar, price );
}
// VWAP /////////////////////////////////////////////////////
So how does this work? Is the code interpreted from the bottom up? Since it seems it now sets it to GfxSetCoordsMode( 1 ); before the cursor is plotted.