Topics
Forum Topics not found
Replies
cAlgo_Fanatic
04 Jun 2013, 14:41
The functions HasCrossedAbove/HasCrossedBelow use a period parameter to determine whether one series has crossed above/below the other over a given period up to the last value. You may use these functions with a period greater than zero (period = 0 will only compare the last value, period = 1 will compare the last and previous to last values, etc. ) or just compare the previous to the last values of your series, depending on your desired solution.
To use the previous to the last determine the last index and apply it to the series:
var lastIndex = MarketSeries.Close.Count - 1; // last index var valueMa = MA1.Result[lastIndex - 1]; // previous to last MA1 value var valueClose = MarketSeries.Close[lastIndex - 1]; // previous to last Close value // compare the two values if(valueClose >= valueMa) { //... do something }
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 12:37
This article should be helpful: http://www.forex-training.com/pip.htm
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 11:19
You can use cAlgo for viewing the results in the Log.
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 11:10
Are you using period = 1 for the RSI?
You can look at the code for the RSI here to better understand the results.
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 10:45
Not at the moment. We may provide this in the future.
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 10:32
You can look at the trailing stop samples we have in the cAlgo platform:
Sample Trailing Stop
Sample Buy Trailing
Sample Sell Trailing
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 10:20
Your suggestion has been noted. Thank you for your feedback.
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 09:30
You may want to use the previous to the last value since the last value changes on each tick. Also, the code should probably go in the OnBar or OnTick event.
@cAlgo_Fanatic
cAlgo_Fanatic
31 May 2013, 11:15
AskEntries and BidEntries are ordered in ascending and descending order of price, respectively. You may just index the first position of each.
price = marketDepth.AskEntries[0].Price; volume = marketDepth.AskEntries[0].Volume;
@cAlgo_Fanatic
cAlgo_Fanatic
30 May 2013, 16:49
We have this in our plans for future implementation.
Thank you.
@cAlgo_Fanatic
cAlgo_Fanatic
30 May 2013, 15:34
It is certanily something important that we will consider for future implementation. Thank you for your feedback.
@cAlgo_Fanatic
cAlgo_Fanatic
30 May 2013, 13:13
RE:
if (position.TradeType == TradeType.Buy && position.Label == Label)
The above will check that the position of the account is a Buy and it has the specified label.
if (position.TradeType == TradeType.Buy)
The above will check that the position of the account is a Buy
if (position.Label == Label)
The above will check that the position of the account has the specified label.
if (position.TradeType == TradeType.Buy || position.Label == Label)
The above will check that the position of the account is a Buy or has the specified label.
[Parameter(DefaultValue = "my Robot")] public string Label { get; set; }
The above is an input parameter for a label.
Also see:
/forum/whats-new/labels-and-a-new-method-to-create-orders
@cAlgo_Fanatic
cAlgo_Fanatic
30 May 2013, 12:20
Try to copy paste the following code into the Calculate method and tell us if it is what you need:
if (!IsRealTime) return; bool condition = _simpleMovingAverage7.Result[index] >= fibbandsRTIndicator.UpperBand3[index] || _simpleMovingAverage7.Result[index] <= fibbandsRTIndicator.LowerBand3[index]; for (int i = 0; i < index - 10; i++) { Result[i] = double.NaN; Result2[i] = double.NaN; Result3[i] = double.NaN; Result7[i] = double.NaN; } for (int i = index - 10; i <= index; i++) { Result[i] = _simpleMovingAverage1.Result[index]; Result2[i] = _simpleMovingAverage2.Result[index]; Result3[i] = _simpleMovingAverage3.Result[index]; if (condition) Result7[i] = _simpleMovingAverage7.Result[index]; } int xPos = index + 1; double yPos = _simpleMovingAverage1.Result[index]; var text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj1", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Lime); yPos = _simpleMovingAverage2.Result[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Yellow); yPos = _simpleMovingAverage3.Result[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj3", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.White); if (condition) { yPos = _simpleMovingAverage7.Result[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj7", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Red); }
I also wanted to let you know that you only uploaded the averageTrueRange Indicator here: /algos/indicators/show/267
@cAlgo_Fanatic
cAlgo_Fanatic
30 May 2013, 09:29
This line will stop the robot:
Stop();
Please note there was a correction in the above code snippet. It should be:
if (Account.Balance - Account.Equity <= 20)
not
if (Account.Equity <= 20)
@cAlgo_Fanatic
cAlgo_Fanatic
29 May 2013, 16:38
( Updated at: 21 Dec 2023, 09:20 )
Hello,
For the first point do you mean additional empty space to the right? If so you can drag the time remaining tool to the left and reveal more space.
For the second point, it will not be possible because the lines will interact with other objects on the chart.
For the third, we will allow users to set up a default template for opening a new chart, so they can choose Timeframes as well.
@cAlgo_Fanatic
cAlgo_Fanatic
29 May 2013, 16:12
We are currently working on this feature for cTrader Web and it will be available in the next release.
@cAlgo_Fanatic
cAlgo_Fanatic
29 May 2013, 15:46
Hello,
You cannot stop all robots from one robot but only the one robot itself that contains the code which stops it.
The code would be such as this:
protected override void OnTick() { if(NotEnoughEquity()) return; //... } private bool NotEnoughEquity() { if (Account.Balance - Account.Equity <= 20) { foreach (Position openedPosition in Account.Positions) Trade.Close(openedPosition); Stop(); return true; } return false; }
@cAlgo_Fanatic
cAlgo_Fanatic
29 May 2013, 15:12
It is unclear what you need. If you use this property:
protected bool LongOnly { get { return Mode == 0; } }
To identify if the input is set for long only signals, then you would use an if statement somewhere in the OnTick() method:
if(LongOnly) { //... }
@cAlgo_Fanatic
cAlgo_Fanatic
04 Jun 2013, 17:02
RE:
You cannot have separated settings for the same broker.
@cAlgo_Fanatic