
stevee damian

Info
Username: | Fron |
Name: | stevee damian |
Member since: | 08 Jan 2020 |
Country: | Mexico |
Favorite symbols:
About
Signature
Last Forum Posts
@Trigger Buy After Moving Above MA and Meets the 150 pips Requirements: 26 Aug 2021, 03:06
amusleh said:
Hi,
You just have to subtract the current price from MA value:
using cAlgo.API; using cAlgo.API.Indicators; using System; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class SimpleMovingAverageSample : Robot { private double _volumeInUnits; private SimpleMovingAverage _simpleMovingAverage; [Parameter("Source", Group = "MA")] public DataSeries MaSource { get; set; } [Parameter("Period", DefaultValue = 9, Group = "MA")] public int MaPeriod { get; set; } [Parameter("Volume (Lots)", DefaultValue = 0.01, Group = "Trade")] public double VolumeInLots { get; set; } [Parameter("Stop Loss (Pips)", DefaultValue = 10, Group = "Trade")] public double StopLossInPips { get; set; } [Parameter("Take Profit (Pips)", DefaultValue = 10, Group = "Trade")] public double TakeProfitInPips { get; set; } [Parameter("Label", DefaultValue = "Sample", Group = "Trade")] public string Label { get; set; } public Position[] BotPositions { get { return Positions.FindAll(Label); } } protected override void OnStart() { _volumeInUnits = Symbol.QuantityToVolumeInUnits(VolumeInLots); _simpleMovingAverage = Indicators.SimpleMovingAverage(MaSource, MaPeriod); } protected override void OnTick() { if (BotPositions.Length > 0) return; var priceDistanceFromMa = Bars.ClosePrices.LastValue - _simpleMovingAverage.Result.LastValue; var priceDistanceFromMaInPips = priceDistanceFromMa * (Symbol.TickSize / Symbol.PipSize * Math.Pow(10, Symbol.Digits)); if (priceDistanceFromMaInPips >= 150) { ExecuteMarketOrder(TradeType.Buy, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips); } } } }
You are Amazing brotha thank you! Not a pro at Csharp but working on it ! Big Step for me! Realized I need to learn more Math.pow and its works !
@Trigger Buy After Moving Above MA and Meets the 150 pips Requirements: 25 Aug 2021, 16:46
amusleh said:
Hi,
Please check the simple moving average example cBot: cAlgo API Reference - SimpleMovingAverage Interface (ctrader.com)
The example cBot opens a buy position if faster MA cross upward the slower MA and a sell position if faster M<A cross downward the slower MA.
If you need something more complicated you can post a job request or ask one of our consultants to develop your cBot.
I have already build serveral bot with crossing MA's I was asking, my question is, what API do i use to trigger a buy in a cbot after its price crosses 150 pips above that MA.
@Trigger Buy After Moving Above MA and Meets the 150 pips Requirements: 25 Aug 2021, 05:41
I need Help with this Idea, I want to have a bot be triggered by crossing the MA, As well Trigger A BUY 150 After. Thank you!
@Backtest with Volume Data: 15 May 2021, 06:33
Yo Team,
is there a way to retrieve volume data when running a backtest? I working on a order book indicador but seems like the volume data is not showing up
cheers
@Measure the distance between price and Moving average: 18 Feb 2021, 22:48
PanagiotisCharalampous said:
Hi Fron,
I am not sure what kind of function are you looking for. This is just a subtraction.
Best Regards,
Panagiotis
I was thinking something like a Gauge like function, it would tell the Percentage of the distance betweeen the two points price and MA, as price draws closer to the other or once it crosses still calculate the differance from price and MA
@Measure the distance between price and Moving average: 14 Feb 2021, 02:04
Good Day,
Is there a function where i can measure the price and Moving average before they cross or touch ?
here is the best example i can explain
@Extract Raw Volume data: 25 Jan 2021, 21:09
PanagiotisCharalampous said:
Hi Fron,
Volume data is available in Bar.TickVolume.
Best Regards,
Panagiotis
Thank you!
cheers
@Extract Raw Volume data: 25 Jan 2021, 06:30
Good Day,
Which Function in ctrader automate can i use to extract raw volume data from the asset
cheers