Replies

TradeMingZhi
27 Mar 2019, 15:22

RE:

Panagiotis Charalampous said:

Hi wisegprs,

Developing such an indicator requires some effort so I cannot help you in this. If you need professional assistance, you can consider contacting a Consultant.

Best Regards,

Panagiotis

Okay Understandable, thanks for reading


@TradeMingZhi

TradeMingZhi
27 Mar 2019, 14:38

oh no actually nope, i would need to have access to On1HourBar() On4HourBar() for it to work but there is no such command rip.


@TradeMingZhi

TradeMingZhi
27 Mar 2019, 14:07

Ok I came up with an elegant solution, no need for RSI High however you can still post if you feel like it as it would help me understand how to solve that particular problem :)


@TradeMingZhi

TradeMingZhi
26 Mar 2019, 12:52 ( Updated at: 21 Dec 2023, 09:21 )

RE:

Panagiotis Charalampous said:

Hi wisegprs,

Based on your description it seems possible.

Best Regards,

Panagiotis

 

Would you be able to help me with that one? I have been thinking of how to possibly make it work, even though I was thinking about it for 5+ hours I couldn't figure this out.

 

Basically I want to have RSI that uses High/Low for latest candle in the series and rest of candles to just be close.

Example Lines:

Rsi1Hour = Indicators.RelativeStrengthIndex(Series1Hour.Close, RsiPeriods);

Series1Hour.High.LastValue();
Series1Hour.Close

 

With what im trying to achieve it will work. The problem I am trying to counter is I have a bot that for example would enter long if:

RSI crossed over 50, and Exit the trade if RSI crossed 70.

However if we have a scenario where it crosses 50 and 70 at same time it will exit and not re enter if the RSI is over 70, however there are scenarios where it goes to 69.9 and it keeps entering everytime it goes under 70 and closes the trade whenever it goes over 70.

If the bot uses High. It will exit and do nothing till next candle then crosed statements will change.

I know perhaps i could Stop it from doing anything else till next bar, but It will conflict with my other entry conditions. So I this would help alot.

An example when this happens:


@TradeMingZhi

TradeMingZhi
28 Feb 2019, 13:39

RE:

Panagiotis Charalampous said:

Hi wisegprs,

The RSI is calculated based on a single value i.e. the close value. This is why it cannot be represented as a candlestick but only as a line. The last value of the RSI is changing because the close price of the last candle is changing on every tick. As soon as the candle is finalized the RSI value will be finalized as well.

Best Regards,

Panagiotis

Yeah exactly, so i guess I will have to create my own RSI indicator that uses close price for last x bars, and the latest bar or 2 bars are High/Low instead.

Would that be possible? to combine dataseries like that?


@TradeMingZhi

TradeMingZhi
27 Feb 2019, 01:51

RE:

bart1 said:

You can try to tweak your fitness function. Genetic optimization stops when there are no improvements after several iterations (fitness function return the same result). Which means you stuck at the local maximum.

Ideally it would be good to have a sim running on top 10 fitness bots infinately till stopped. (Trying to find better settings).

Don't do this, you will quickly find a local maximum without exploring other possibly more profitable areas.

 

 

Here is a very good video lecture from MIT about Genetic Algorithms.
https://www.youtube.com/watch?v=kHyNqSnzP8Y

Besides explaining how GA works, it shows simple examples of how you can stuck on a local maximum without exploring the whole area of possible outcomes.
 

Regards,
Bart

Thanks the video seemed helpful!


@TradeMingZhi

TradeMingZhi
24 Feb 2019, 16:38

for example bots that did no trades in first 5 days i could kill, that would speed up things insanely.


@TradeMingZhi

TradeMingZhi
24 Feb 2019, 16:27

I would want to kill certain bots that do certain things, mid way while testing, but all that would do is kill of the genetic evolution and whole optimisation test will stop very soon.

by just using Stop();


@TradeMingZhi

TradeMingZhi
24 Feb 2019, 16:24

My question is do bots improve mid test? or they must finish the whole backtest to then try to improve their scores?

I couldnt find any articles about Generic algorythim, only the basic stuff that is avilable in the UI, but nothing about coding aspects of it.


@TradeMingZhi

TradeMingZhi
06 Feb 2019, 11:45

RE:

Panagiotis Charalampous said:

Hi wisegprs,

I am not sure what the question is. The code seems fine to me.

Best Regards,

Panagiotis

Yeah i realised shortly after, no option to delete thread though

You can delete it, thanks!


@TradeMingZhi

TradeMingZhi
05 Feb 2019, 19:15

and this under parameters:

        public bool LongPositionOpen;
        public bool ShortPositionOpen;
        public bool LongOrderOpen;
        public bool ShortOrderOpen;

 


@TradeMingZhi

TradeMingZhi
05 Feb 2019, 19:12

RE:

Panagiotis Charalampous said:

Hi again,

You can extend the condition. See an example below

var hasBuyOrders = PendingOrders.Count(x => x.TradeType == TradeType.Buy && x.SymbolCode == Symbol.Code && x.Label == "label") > 0;

Best Regards,

Panagiotis

Works well!

 

If anyone is looking for similar solution then use this code:

        public static readonly string BotName = "Your Bot name"; // Put this under parameters
        private void CheckOrders()
        {
            LongPositionOpen = Positions.Find(BotName, Symbol, TradeType.Buy) != null;
            ShortPositionOpen = Positions.Find(BotName, Symbol, TradeType.Sell) != null;
            LongOrderOpen = PendingOrders.Count(x => x.TradeType == TradeType.Buy && x.SymbolCode == Symbol.Code && x.Label == BotName) > 0;
            ShortOrderOpen = PendingOrders.Count(x => x.TradeType == TradeType.Sell && x.SymbolCode == Symbol.Code && x.Label == BotName) > 0;
            Print("Long Position Opened?: " + LongPositionOpen);
            Print("Short Position Opened?: " + ShortPositionOpen);
            Print("Long Order Opened?: " + LongOrderOpen);
            Print("Short Order Opened?: " + ShortOrderOpen);
        }

 


@TradeMingZhi

TradeMingZhi
05 Feb 2019, 15:31

RE:

Panagiotis Charalampous said:

Hi wisegprs,

Thanks for posting in our forum. You can use something like this

var hasBuyOrders = PendingOrders.Count(x => x.TradeType == TradeType.Buy) > 0;

Best Regards,

Panagiotis

 

Thanks for quick reply, what If i wanted to also check for bots name and symbol?


@TradeMingZhi