BE
Topics
Forum Topics not found
Replies
behkam21
06 Oct 2018, 19:46
RE:
OOSilgjerd said:
Hi, I'm a complete beginner in programming so please excuse my lack of knowledge.
I am attempting to make a cBot that enters a long position if:
- The last candle closed above the kumo (cloud)
But only if:
- It opened inside or on the opposite side of the kumo and
- It is currently no more than 30 pips away from the kumo.
(Opposite requirements for a short position).
I know a lot is wrong with this code, I need to be pointed in the right direction and taught some code on how to do a few things. I'm not asking you to make my entire bot although it would have been awfully nice if somebody could do maybe a little bit for me ;)
I need help on:
- The buy and sell signals (and then make it execute the orders)
- Setting SL and TP (make two positions, SL 25 pips on both, TP 20 pips on one, 30 pip trailing stop triggered when @ 30 pip profit on the other)
- Make the SL move to break even when the 20 pip SL is hit on the first trade.
//#reference: ..\Indicators\Ichimoku_cloud2.algo using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC)] public class IchimokuBreakoutBot : Robot { private Ichimoku_cloud2 Ichi; [Parameter("Volume", DefaultValue = 100000)] public int Volume { get; set; } protected override void OnStart() { Ichi = Indicators.GetIndicator<Ichimoku_cloud2>(); } protected override void OnBar() { if (HasCrossedAbove(Ichi.SenkouSpanA, Ichi.SenkouSpanB && MarketSeries.Close > Ichi.SenkouSpanA)) ; { OpenPosition(TradeType.Buy); } }
@behkam21
behkam21
06 Oct 2018, 19:46
RE:
lucian said:
@behkam21