Convert Python to EX4 metatrader

Hello,

I am backtesting a simple strategy on BlueShift (RSI+Double Ema). From the Blueshift backtest it seems quite stable. But I cannot check the positions , just check the monthly numbers and DD.

How can I see them? Or can someone convert it to ex4 metatrader ?

 

You can use the 'context' variable to check your current positions. For example define a function:

 

def print_positions(context, timestamp, PLATFORM='B'):
    positions = context.portfolio.positions
 
    if not positions:
        return
 
    print('{}: existing positions'.format(timestamp))
    for asset in positions:
        print(positions[asset])

 And then you can call this function from somewhere else (for example from handle_data) to see the current positions. Also when you run a full backtest, you get the list of all trades your strategy did. If you go live, you can see both your trades as well as current positions on the live trading dashboard.