Topics
Replies
firemyst
25 Dec 2024, 08:15
( Updated at: 27 Dec 2024, 07:34 )
Don't hold your breath waiting. They did it as dots because of the limitations of their system.
While Spotware may implement a SuperTrend as a line with one color, unless they use the dots, they can't do up/down colors easily. I suspect they chose to do dots instead of a one color line since the ST usually has an “up” and “down” color.
I agree with you that dots are pointless, which is why I wrote my own ST to have colored lines.
@firemyst
firemyst
25 Dec 2024, 08:02
( Updated at: 27 Dec 2024, 07:34 )
Write your own indicator to do this.
All you have to do is print to the chart the property Symbol.Spread
Or download one that's already made:
https://community.ctrader.com/algos/indicators/show/3217/
https://clickalgo.com/spread-meter
https://clickalgo.com/spread-display-indicator
@firemyst
firemyst
23 Dec 2024, 01:21
As a work around, you could always write your own log output to see if that meets your needs?
if ((position.TradeType == TradeType.Buy && Bars.ClosePrices[index1] < _ExitMA1.Result.LastValue) || (position.TradeType == TradeType.Sell && Bars.ClosePrices[index1] > _ExitMA1.Result.LastValue))
{
ClosePosition(position);
Print("Exit EMA 1 closed position. ClosePrice {0}, EMA Value {1}", Bars.ClosePrices[index1], _ExitMA1.Result.LastValue);
}
@firemyst
firemyst
23 Dec 2024, 01:01
No, because the API documentation clearly states, “Shortcut for Robot.ModifyPosition method to change the Stop Loss.” and “ModifyPosition” is not asynchronous.
Also, all their current API calls that work asynchronously are labelled as being asynchronous, such as “ModifyPositionAsync” and “ModifyPendingOrderAsync”.
If you need/want to modify the stop loss asynchronously, you'll probably want to use “ModifyPositionAsync”. Yes, that means you're going to have to provide all the required parameters, which you should be able to gather most of the information from your current position.
Ex:
var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
if (position != null)
ModifyPositionAsync(position, position.StopLoss.GetValueOrDefault() + (Symbol.PipSize * 10), position.TakeProfit);
@firemyst
firemyst
14 Dec 2024, 05:59
( Updated at: 14 Dec 2024, 06:22 )
RE: RE: Error with Arrays - Beware!!
PhoenixCapital said:
Perhaps, this is new. Older versions of ctrader didnt do this at all. I have been doing this for 2 years.
It has always been like this. This is how C# has been working since it was first introduced back in early 2000's - even before Spotware's time.
If you want evidence, download a copy of Visual Studio 2015:
https://visualstudio.microsoft.com/vs/older-downloads/
Create a basic C# console application, set the .Net framework to either 2.0 or 3.5 (if possible) and put your code in there.
:-)
@firemyst
firemyst
13 Dec 2024, 00:42
( Updated at: 13 Dec 2024, 06:34 )
This is not a Spotware issue.
The solution is you need to better understand how arrays and objects are copied in C#.
When you say “prices = PriceList”, you're assigning the underlying reference of PriceList to prices, meaning whatever you change in one, changes in the other.
If you want to copy the actual values, you need to either:
- use a loop to copy each value in the array
- Google search and learn how to do it other ways, such as : https://stackoverflow.com/questions/14651899/create-a-copy-of-integer-array
@firemyst
firemyst
13 Dec 2024, 00:31
Nearly 9 years on and since Spotware still hasn't provided this functionality, here's a suggestion if you don't program up your own, you can always do the math to compensate.
For instance, if you have a 20 period ema on the M1 chart, on the M30 chart change the period 600 (30 minutes * 20 period length on m1 chart)
@firemyst
firemyst
27 Dec 2024, 00:17 ( Updated at: 27 Dec 2024, 07:34 )
If you want the best results for each month or day, you'll probably have to run the optimization for each individual month or day when selecting the date range.
@firemyst