Topics
Replies

firemyst
13 Jul 2023, 11:06

RE: close part of position

aloin.eldar said:

Hi there guys,

Sorry for approaching in another issue, because i can't get an answer anywhere else.

Let's say i open a position of 0.5 lot, and i want to close 0.3 (meaning - leave 0.2)

Why does the platform closes the position entirely and open up a new one, of 0.2 lot, at the time of the previous close?

Is this right?

BR

Maybe if on the other threadds you started you post screen captures showing examples as evidence of what's happening, you'd get some responses.


@firemyst

firemyst
13 Jul 2023, 11:05

And the accounts keep disconnecting and reconnecting today. It's like the demo server feed can't keep it up.


@firemyst

firemyst
13 Jul 2023, 03:43

//Does this get what you want?

if (!obj.IsSuccessful)
{
    if (obj.Error.HasValue)
    {
        Print("Error! : {0}", obj.Error.Value.ToString();
    }
}

 


@firemyst

firemyst
11 Jul 2023, 14:58

You'll need to call the OnBar method yourself, so you can then execute code both before and/or after it.

 


//Example code

//class variable. Set to zero in the OnStart method so it's 0 every time you start your bot
int _previousIndex;
int _currentIndex;

//in the "OnTick" Method
protected override void OnTick()
{
    //do whatever you need to do in OnTick first here

    _currentIndex = _marketSeries.OpenTimes.GetIndexByTime(_marketSeries.OpenTimes.LastValue);

    //Call the OnBar method yourself. Just make your own. 
    if (_currentIndex != _previousIndex)
    {
        //when currentIndex isn't equal to previous index, we know a new bar has opened
        //so call your own OnBar method:
        OnBarForBot();
        _previousIndex = _currentIndex;
    }

    //Now do whatever you have to after you called your OnBar method
}

private void OnBarForBot()
{
    //do whatever you want to on each new bar
}

//Don't have anything in the built in method. 
protected override void OnBar()
{
}

 


@firemyst

firemyst
11 Jul 2023, 14:51

@ClickAlgo doesn't support their software unless it's a bug or you've paid for it.

I wonder why they can't help?

 


@firemyst

firemyst
08 Jul 2023, 08:06

RE:

ctid1531384 said:

Yes aware of them. And the ones I asked about? Just gone?

These?

 

 


@firemyst

firemyst
07 Jul 2023, 03:41

As a follow on to the above from @lisandronahuelhillebrand , see this page for more information about Opposite Side of Trade:

 


@firemyst

firemyst
07 Jul 2023, 03:30

 


@firemyst

firemyst
07 Jul 2023, 03:29

Your post makes no sense


@firemyst

firemyst
07 Jul 2023, 03:29

Good place to start:

 


@firemyst

firemyst
07 Jul 2023, 03:24

Why not post the code you have so people can correct it?

 

In a nutshell:

1) set your time zone in your indicator if you choose:

    [Indicator(AccessRights = AccessRights.None, TimeZone = TimeZones.AtlanticStandardTime)]

2) get your time Server.Time or if you want your local computer's DateTime.Now

3) compare that the hour of the time you got is >= 8 && <= 9

4) if 3 is true, Chart.DrawHorizontalLine on whatever value you want at 8 and 9am prices. Depending on the chart you're using, you may need to get tick data as opposed to the chart's time frame (eg, if you use something like Range or Renko, you can't depend on a bar's time as a new bar may not open/close on the exact hours)


@firemyst

firemyst
07 Jul 2023, 03:15

//just provide the source to the dataseries parameter when creating the RSI in your code:

RelativeStrengthIndex _rsi = Indicators.RelativeStrengthIndex([the data series of the symbol/timeframe you want the rsi to act upon], Periods);

 


@firemyst

firemyst
07 Jul 2023, 03:12

You're using the .Last incorrectly.

.Last should have an index indicator how many bars back you want.

 

If you want the last (most recent) value, then you need to use either:

.Last(0)

.LastValue

 


@firemyst

firemyst
05 Jul 2023, 03:24

You need to post any suggestions here:

 


@firemyst

firemyst
05 Jul 2023, 03:23

One way to do it is you need to keep track of your engulfing candles. You might want to use something like two Dictionary<int,double>() objects (one for bull candles and one for bear candles) where the key is the "bar's index" and the value is the high/low of the price.

On every new bar:

1) check every value in the bullish dictionary

2) if current price > the price of an entry in the dictionary (each value), a) delete the indicator icon at the specified bar (the key value) and b) delete the key/value pair from the dictionary as you know you don't have to check it ever again.

3) repeat steps 1-2 above for the bearish dictionary

4) if the previous bar is a bullish engulfing candle add the bar's index as the "key" to the bullish dictionary with the high price as the "value"

5) if the previous bar is a bearish engulfing candle add the bar's index as the "key" to the bearish dictionary with the low price as the "value"

 


@firemyst

firemyst
04 Jul 2023, 11:00

Hypothetically what you could do is:

//To find a bearish fractal in a range:
int startIndex = 4;
int endIndex = 7;
array.Skip(startIndex).Take(endIndex - startIndex).Max();

And see if the middle value of the array is equal the max value returned. If so, it's a bearish fractal.

note that according to the definition of a bearish fractal is as follows from Investopedia:

  • bearish turning point occurs when there is a pattern with the highest high in the middle and two lower highs on each side.

     

It doesn't say each high has to be lower/higher than the previous/next. Only that the one in the middle has to be the highest/lowest. So given that interepretation, you could use the sample code I put in at the top here.

If you do want it with each candle getting consecutively higher/lower from the middle one, I don't know how you do that without looping over each value.


@firemyst

firemyst
04 Jul 2023, 02:29

What you should try doing is looking at how others have done it, and adapt your code as appropriate.

For example:

 

 


@firemyst

firemyst
04 Jul 2023, 02:18

You're not going to get any help since you haven't posted any information.

What error messages are you receiving in the logging tab?

What have you tried doing in your code to try and find the issues?

Is it on Windows 10 or 11?

A VPS?

etc etc

 

 


@firemyst

firemyst
04 Jul 2023, 02:17

Your list is great and you've given thought to these.

 

However, what I would do (and I know this is tedious) is break them up and post the suggestions one by one. This way, users can vote on individual suggestions for Spotware to implement instead of one big list that probably won't garner nearly as many votes or people reading.

For instance, if someone votes on this list, what item in particular are they voting for? Nobody knows.

 


@firemyst

firemyst
04 Jul 2023, 02:15

Your suggestion would hold more weight and be more noticeable to Spotware if you decided to post this suggestion where it belongs (in the suggestion forum) instead of a technical help forum.

 

 


@firemyst