Topics
Replies

firemyst
17 Jun 2023, 06:04

Your bot is closing all positions because you tell it to:

private void CloseAllPositions()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);
            }
        }

 

If you only want to close positions that your bot has specifically opened, then it's a two step process:

1) when you open a position, you need to assign a label to it (eg, "acBotPosition"), which is a string.

2) when looping through all the open positions, only close those positions whose label matches "acBotPosition":

private void CloseAllPositions()
        {
            foreach (var position in Positions)
            {
                if (position.Label == "acBotPosition")
                    ClosePosition(position);
            }
        }

 

 

As for the cut scenario, I wouldn't use the "HasCrossedAbove" method.

Instead, I would use logic similar to the following:

if (_fastMA.Result.Last(1) > _slowMA.Result.Last(1))
{
	ExecuteStrategy(TradeType.Buy);
}
else if (_fastMA.Result.Last(1) < _slowMA.Result.Last(1))
{
	ExecuteStrategy(TradeType.Sell);
}

 


@firemyst

firemyst
17 Jun 2023, 05:54

This happens a lot with WIndows Programs (not just cTrader). I find it happens when you have two displays that are different resolutions (eg, laptop screen FHD, monitor 4k) and the higher resolution monitor gets disconnected _before_ running program is brought over to the primary display. Windows remembers program display locations, so as a result, it appears off screen when the second display isn't connected any more. It's a hassle.

Ways to try fixing it which have helped me in the past:

 

 


@firemyst

firemyst
17 Jun 2023, 05:49

See my reply in your other thread:

 


@firemyst

firemyst
17 Jun 2023, 05:48 ( Updated at: 21 Dec 2023, 09:23 )

Your watch list?

Since nobody else has spoken up, here's something you can try:

 - using your default settings file. You can find it in a location similar to:

In that file has the listing of your watch lists.

If you open that file up in Notepad, Notepad++, or some other similar text editor, it will have binary characters in it, but it will also have the symbols in your watch list, listed out.

For example, here's part of my watch list:


@firemyst

firemyst
16 Jun 2023, 20:07

Why is this question posted under "Suggestions"?

This should be posted under

or

 

> To date it is not possible to modify volume for the position and/or direction.

It sure is. Please post your question in the other groups for an answer. This forum is for "suggestions", not "questions".

 


@firemyst

firemyst
16 Jun 2023, 20:02 ( Updated at: 21 Dec 2023, 09:23 )

What version of cTrader do you have? It shows up in the "what's new" for version 4.7.12 :

 


@firemyst

firemyst
16 Jun 2023, 19:57

IndicatorArea.DrawTrendLine()


@firemyst

firemyst
15 Jun 2023, 15:46

 


@firemyst

firemyst
15 Jun 2023, 15:44

You do realize there's already one available?

 

 


@firemyst

firemyst
14 Jun 2023, 03:14

 


@firemyst

firemyst
14 Jun 2023, 03:12

RE:

danor60000 said:

Good afternoon everyone. Help me figure out how to make the TakeProfit and StopLoss indicator so that when its price approaches, it moves up (down). Thank you in advance.

I provided example logic in this thread:

 


@firemyst

firemyst
12 Jun 2023, 16:13 ( Updated at: 21 Dec 2023, 09:23 )

Of course you're getting that error.

See what the API is expecting?

Not a double value, which you have as "0.001".

You need to pass it the "Bars" you want, or remove the first parameter entirely to use the current chart's bars.


@firemyst

firemyst
12 Jun 2023, 16:02

Have you tried altering the access rights permissions of your bots?

 


@firemyst

firemyst
10 Jun 2023, 05:22

Have you tried looking for any free ones that someone may have done already?

 

If not, you can see if anyone else on these forums help out.


@firemyst

firemyst
09 Jun 2023, 15:17

if (distance between current ask or bid price and current take profit price is within x-pips of yourposition.TakeProfit.GetValueOrDefault())

{

    yourPosition.ModifyTakeProfitPrice( yourposition.TakeProfit.GetValueOrDefault() + (Symbol.PipSize * number of pips you want to move it forward);

}


@firemyst

firemyst
09 Jun 2023, 03:16

Post it to the suggestions forum:

 


@firemyst

firemyst
09 Jun 2023, 03:14

To make sure Spotware gets and receives this, please also report it through cTrader:

 

In the text box, put the link to this thread.

If you can, also put in the technical details from the event-viewer you captured as well.


@firemyst

firemyst
09 Jun 2023, 03:09

The code you have gets the EMA values for the Higher Time Frame, which is the daily chart.

The charts you're showing in the screen captures are the 4 hour charts.

So while on the GBPCHF 4-hour chart the fast email is below the slow ema, on the daily chart, the fast ema can still be above the slower ema, hence only the one arrow being displayed on the 4 hour.

 


@firemyst

firemyst
09 Jun 2023, 02:59

Another FAIL on Spotware's part by whoever's in charge of the API team.

See the example I left for you on your other thread with Moving Averages

 


@firemyst