Launch orders from portfolio backtester


#1

//-------------------------------------------
SetOption( “InitialEquity”, 100000 );
PositionSize=1000;
SetOption( “MaxOpenPositions”, 50 );
TradeSize = 2000;

FAST = MA(C, 50);
SLOW = MA(C, 200);

Buy = Cross(FAST, SLOW);
Sell = Cross(SLOW, FAST);

//--------------------------
SetCustomBacktestProc( “” );
If ( Status( “action” ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest();
For ( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
{
IS IT POBBILE TO LAUNCH ORDER FROM HERE WITH IBC.PLACEORDER() ??
}
}
Thank you.


#2

In theory it’s possible, but why would you want to place orders for already closed trades?

From: https://www.amibroker.com/guide/a_custombacktest.html
image


#3

Hello Helix Trader

I have replaced with open pos::monkey_face:
for (trade = bo.GetFirstOpenPos (); trade; trade = bo.GetNextOpenPos ()) and now it works perfectly for me.

I have also been able to send the orders to ibcontroller from here :slight_smile:

ibcontroller

It’s for an end-of-day system, but it will take a lot of work to enter orders every day.
interactive

Thank you very much for your help !!


#4

Can you let me know what version of IB you are using please?


#5

Sure,
IB