Hello Friends!
My automated trading works as follows: Amibroker sends signals via IBControler and then TWS sends the orders on the market.
But I have to many signals in the row.
Now it works like this for example (minute candle): buy, buy, buy, sell, sell, sell, sell, buy, sell, sell, buy, sell, buy, sell, buy, buy, buy, sell, sell
But I want to improve like this (minute candle): buy, sell, buy, sell, buy, sell, buy, sell, buy, sell,
Can you help me please?
This is my AFL:
Buy = Close>Ref(Close,-10);
Sell = Close<Ref(Close,-10);
if( LastValue( Buy ) )
{
ibc = GetTradingInterface("IB");
// check if we are connected OK
if( ibc.IsConnected() )
{
// transmit order
ibc.PlaceOrder( "ALE-WSE-STK-PLN", "Buy", 200, "MKT", 0, 0, "Day", True );
}
}
if( LastValue( Sell ) )
{
ibc = GetTradingInterface("IB");
// check if we are connected OK
if( ibc.IsConnected() )
{
// transmit order
ibc.PlaceOrder( "ALE-WSE-STK-PLN", "Sell", 200, "MKT", 0, 0, "Day", True );
}
}
Short = Sell;
Cover = Buy;
My automated trading works as follows: Amibroker sends signals via IBControler and then TWS sends the orders on the market.
But I have to many signals in the row.
Now it works like this for example (minute candle): buy, buy, buy, sell, sell, sell, sell, buy, sell, sell, buy, sell, buy, sell, buy, buy, buy, sell, sell
But I want to improve like this (minute candle): buy, sell, buy, sell, buy, sell, buy, sell, buy, sell,
Can you help me please?
This is my AFL:
Buy = Close>Ref(Close,-10);
Sell = Close<Ref(Close,-10);
if( LastValue( Buy ) )
{
ibc = GetTradingInterface("IB");
// check if we are connected OK
if( ibc.IsConnected() )
{
// transmit order
ibc.PlaceOrder( "ALE-WSE-STK-PLN", "Buy", 200, "MKT", 0, 0, "Day", True );
}
}
if( LastValue( Sell ) )
{
ibc = GetTradingInterface("IB");
// check if we are connected OK
if( ibc.IsConnected() )
{
// transmit order
ibc.PlaceOrder( "ALE-WSE-STK-PLN", "Sell", 200, "MKT", 0, 0, "Day", True );
}
}
Short = Sell;
Cover = Buy;