WARNING: Martingale is subject to HUGE drawdown spikes, use at your own risk!
updated function to also double(aply multiplier) on even trades, example with a MA's crossover.
some simple functions to handle account margin call / trailling stop for account.
Functions with parameters do not work correctly: the returned value is sometimes different from the expected one.
The example script works correctly only when idx = 1 (instead of the current line 6).