Specifiche
I would like the bot to do the following basic checks:
1) Once a day
1.1 Once a day(e,g. at 23:00) compute MA(33) on the 1d time frame.
1.2 The standard deviation of the price difference (p-MA(33)) over N last candles (N is set as the input)
1.3 The current value s=(p[last]-MA(33))/std
1.4 If the result from 1.3 is higher than the input threshold S (s>S), then set "SHORT" as the 1d-direction. if s <S, set "LONG". Else hold on.
2) on the 15m timeframe.
2.1 compute Bollinger(13,1.5) which gives the bands: bol_up=MA(13)+1.5std, bol_down=MA(13)-1.5std
2.2 compute a MA(2)
If the result from 1) was SHORT, and MA(2)>=bol_up, enter the market with a predefined amount (input variable).
If the result from 1) was LONG, and MA(2)<=bol_down, enter (market order) with a predefined amount (input variable)
If the result from 1) is "stand by", do nothing.
3) Tracking
If we are in the market:
3.1 if the profit is <0: exit if the market entry price (p_e) and the current price (p_c) differ more than 2std from the bollinger:
exit if abs(p_e-p_c)>std
3.2 If the profit increased and abs(p_e-p_c)>std, set the stop exit to p_e+0.1pip
3.3 If the profit increased more than (p_e-p_c)>2std, set the stop to p_c-std
Perform 3.2 and 3.3 only if the "best" price is reached. e.g. in the case of a "LONG" trade, check if p_e >max(p) since the market entry.