Topics
Replies

firemyst
01 Jun 2023, 05:05

RE:

rafiki.matu said:

Hey guys, 

Trying to code an indicator that gives and arrow notification when the fast MA crosses the slow MA either from above or below. 
How do i add a filter to the code to include the 200 EMA and only give a notification when the cross occurs above the 200 EMA for buy signals and below the 200 EMA for sell signals. 
Anything i try gives errors.

Below is the piece of code where am stuck. 

The code does work whenever there is a MA cross but i want to add a filter to only give alerts after incorporating the 200EMA. 

if(Functions.HasCrossedAbove(fastMA.Result, slowMA.Result, 0)){
                Chart.DrawIcon("HasCrossedAbove",ChartIconType.UpTriangle,Bars[index].OpenTime,Bars[index].Low-arrowOffset,Color.LightBlue);
                
                if (Playsound && Cup<2 ){
                    Notifications.PlaySound(SoundPath);
                    Cup++;
                    Cdown=0;
                    }
                
                }

            if (Functions.HasCrossedBelow(fastMA.Result, slowMA.Result, 0)){
                
                Chart.DrawIcon("HasCrossedBelow",ChartIconType.DownTriangle,Bars[index].OpenTime,Bars[index].High+arrowOffset,Color.Red);
                
                if (Playsound && Cdown<2 ){
                    Notifications.PlaySound(SoundPath);
                    Cdown++;
                    Cup=0;
                   
                    }
                
                }
        }

        

    }
}

 

Any help will be highly appreciated. 

Thanks. 


 

 

Just test to see if the current closing price is above/below the 200MA.

//This is a mixture of sample/pseudo code but hopefully is enough to get you started
if (Bars.ClosePrices.LastValue > MA200.Result.LastValue)
{
	if (Functions.HasCrossedAbove(fastMA.Result, slowMA.Result, 0))
	{
		Chart.DrawIcon("HasCrossedAbove",ChartIconType.UpTriangle,Bars[index].OpenTime,Bars[index].Low-arrowOffset,Color.LightBlue);
                
                if (Playsound && Cup < 2 )
		{
                    Notifications.PlaySound(SoundPath);
                    Cup++;
                    Cdown=0;
		}
	}
}

else if (Bars.ClosePrices.LastValue < MA200.Result.LastValue)
{
	if (Functions.HasCrossedBelow(fastMA.Result, slowMA.Result, 0))
	{
		Chart.DrawIcon("HasCrossedBelow",ChartIconType.DownTriangle,Bars[index].OpenTime,Bars[index].High+arrowOffset,Color.Red);
                
                if (Playsound && Cdown < 2 )
		{
                    Notifications.PlaySound(SoundPath);
                    Cdown++;
                    Cup=0;
		}
	}
}

 


@firemyst

firemyst
01 Jun 2023, 04:55

Example to help you get started:

 

if (Bars[index].OpenTime.DayOfWeek != DayOfWeek.Sunday)

{

}

else

{

// skip Sunday

}

You just have to make sure your bot is set to work in your time zone, otherwise if your market data is being derived in another time zone, obviously that Sunday might not line up with your Sunday.


@firemyst

firemyst
01 Jun 2023, 04:48

You should post this in the "Suggestions" forum:

 


@firemyst

firemyst
30 May 2023, 11:56

You can use the TickVolume api and do your own calculations to determine pressure, or use any of the many indicators that do things with Tick volume.

An example:

 

And the cTrader indicator archive:

 


@firemyst

firemyst
30 May 2023, 11:51

Please post this to the Suggestions forum:

 


@firemyst

firemyst
29 May 2023, 15:52 ( Updated at: 21 Dec 2023, 09:23 )

RE:

PrincipalQuant said:

I'm looking for some fresh perspectives on this topic. Any ideas?

So your GPU isn't being utilized? Mine is:


@firemyst

firemyst
29 May 2023, 10:28

I would post this in the "Suggestions" forum:

 


@firemyst

firemyst
29 May 2023, 09:30

RE:

PanagiotisChar said:

@firemyst,

No need to tag us on every discussion :) If we haven't replied then probably we can't help. As far as I know this information is not available via the API

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Well there you go @PanagiotisChar. Now that you've responded to this one you've just helped since nobody else seems to have known :-)

PS: I only tag you since you have all the insider info and knowledge about the product, or at least more than us regular joe-schmoes do :-)


@firemyst

firemyst
29 May 2023, 08:49

Great.

Yeah, the mobile version is a bit ridiculous with the little amount you can customize compared to other mobile trading platforms.

Get this, on the mobile version, even the only way to change the chart colors is changing the entire theme on your phone from "light" to "dark". They used to have it where you can specify the chart be in light or dark mode. Now, in order to do that, you have to put your entire phone in "dark theme", which is completely idiotic.

I really think Spotware needs to get a new person, who has actually looked at what competing products are capable of doing, and driving a better mobile version balancing features,  performance, and what traders actually want if they do put "traders first".


@firemyst

firemyst
29 May 2023, 06:18

Do you want the exceeds of $1250 to be gross profit or net profit?

Here's an example to test net profit on your account:

            if (Account.UnrealizedNetProfit > 1250)
            {
                foreach (Position p in Positions)
                {
                    ClosePosition(p);
                }
            }

 

 


@firemyst

firemyst
29 May 2023, 06:08

@PanagiotisChar? Anyone?


@firemyst

firemyst
29 May 2023, 06:03

I don't think so. I think what you'll have to do is have a separate button or checkbox to hide the indicator drawings before someone clicks the eyeball to hide the indicator.

 

This means you'll have to have the indicator keep track of all its drawings so it can show/hide them when the button/checkbox you create is checked/unchecked.


@firemyst

firemyst
29 May 2023, 03:53

Some of the color options you can change:


@firemyst

firemyst
29 May 2023, 03:51

RE: Suggestions for mobile

Nick24 said:

5:

We need to have more customization options. For instance, changing colors of candlesticks, grid lines, etc.

 

These options are already there. Just change the color options:


@firemyst

firemyst
29 May 2023, 03:49

RE: Suggestions for mobile

Nick24 said:

Trading:

 

11:

We need to have a multi-chart mode.

 

You should explain this a bit more on what you expect from this, because @Spotware will come back and say, "there's already a multi-chart mode", which there is if you click here:


@firemyst

firemyst
29 May 2023, 03:16 ( Updated at: 21 Dec 2023, 09:23 )

RE:

lindawati92sufi said:

i buy 0.2 lot eur/usd at 18th and closed it in 19th today
i should pay swap 1.5usd not 15usd

Maybe you should try switching to Pepperstone?

 


@firemyst

firemyst
29 May 2023, 03:03 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE:

Automated_Trading said:

firemyst said:

Read this thread and do what's suggested:

 

 

 

Now the cTrader is loading the data each time I want to optimize or backtest the bot. I ran the backtesting letting the data load. I tried again using the same history, but it loads the data again. It is not saving the data. I closed the cTrader and restarted my computer several times, but the problem persists.

Do you maybe know how to fix this?

 

@PanagiotisChar? @Spotware? Anyone else?


@firemyst

firemyst
28 May 2023, 14:04

I see this thread hasn't been responded to, so thought I might say something in case it's still an issue? Or you'd like to revisit with a possible work around?

For starters, I would try this:

I haven't used it, but should allow for non-blocking operations because at the bottom of the page, it says, "While a message box is displayed, all other cBot/indicator events will be invoked normally."

Let us know how it works for you.


@firemyst

firemyst
28 May 2023, 13:51

Well, I do agree with you about it being somewhat easy to code.

You'll have to speak to Spotware about it. Or offer your coding services for them :-)

 

But in the interim, perhaps post it to the "Suggestions" forum:

 


@firemyst

firemyst
28 May 2023, 06:34

See this thread:

 


@firemyst