Sending Email Alerts with Entry Price

Questions about MultiCharts and user contributed studies.
flomtl
Posts: 6
Joined: 23 Jan 2014
Location: Montreal
Has thanked: 3 times

Sending Email Alerts with Entry Price

Postby flomtl » 30 Jan 2014

I would like to trigger an email alert on trade entries and exits which includes the price at which my trade was filled at.

I am using the following in my easy language code: (triggered after my entry conditions are met)

alert(text("Long Entry at:", Entryprice_checked));

What is the difference between Entryprice, Entryprice_checked, PosTradeEntryPrice?

Additionally I was wondering if someone knew what the "Price:" field in default alert messages is reporting?
(The alert() triggered email comes with a few fields that are fixed and always included: Source, Instrument, Resolution, Price, Message)

thanks

Florian

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Sending Email Alerts with Entry Price

Postby Henry MultiСharts » 31 Jan 2014

Hello Florian,

EntryPrice - Returns the price of the initial entry into the specified position.

With PosTradeEntryPrice you can get the price not only of the initial entry, but of the other trades of the specified position as well.

EntryPrice_Checked will generate an error if PosBack value is greater that the real number of previously opened positions, while EntryPrice will not do that.
Additionally I was wondering if someone knew what the "Price:" field in default alert messages is reporting?
This is the chart close price at the moment of alert generation.

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Sending Email Alerts with Entry Price

Postby beck donald » 08 Apr 2014

I have been working on getting emails sent. I am doing something wrong and need help!

1. When an order is placed.
or
2. When a trade is filled.
and when a profit target has been reached.

I am closer but still not there. I am first focusing on when a trade fills.

My strategies will take on more than one trade in a position.

The only reference I am making to alerts, is in

protect override void CalcBar(), which contains various conditions as it relates to time and date, at the end my send code.

To the above, I added
Alerts.Alert("Long Entry", PosTradeEntryPrice);

The way I have it applied, I find Alerts.Alert("Long Entry", PosTradeExitPrice);
to provide identical results.
I have used it in place of PosTradeEntryPrice
I have used it on another line, following PosTradeEntryPrice
I have tried it in a separate strategy, profit target.


I get 2 emails with each filled signal, one for each of PosTradeEntryPrice and PosTradeExitPrice

An example of how this should be coded would be really appreciated.

Thank you!! DB

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Sending Email Alerts with Entry Price

Postby Henry MultiСharts » 08 Apr 2014

That is possible to generate an alert only after the actual position for the instrument changes.
Please check OnBrokerPositionChange, OnBrokerStategyOrderFilled

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Sending Email Alerts with Entry Price

Postby beck donald » 08 Apr 2014

Henry,

I find little reference material on those. Are there any examples of their use?

Thank you,
Don

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Sending Email Alerts with Entry Price

Postby JoshM » 08 Apr 2014

(...)

The only reference I am making to alerts, is in

protect override void CalcBar(), which contains various conditions as it relates to time and date, at the end my send code.

To the above, I added
Alerts.Alert("Long Entry", PosTradeEntryPrice);

The way I have it applied, I find Alerts.Alert("Long Entry", PosTradeExitPrice);
(...)
Which MultiCharts version do you use?

I'm asking since `PosTradeExitPrice` and `PosTradeEntryPrice` are MultiCharts PowerLanguage reserved words, while the `Alerts.Alert()` method only exists in MultiCharts .NET. You seem to combine these two in the same programming code.

Or did you create variables in MultiCharts .NET with the exact same name as MultiCharts PowerLanguage reserved words?

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Sending Email Alerts with Entry Price

Postby beck donald » 08 Apr 2014

Josh,

At this time, I am running both versions. I made the mistake of posting to the wrong forum. I would prefer to get it done in Net, but will work with PL. Appreciate any help!

DB

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Sending Email Alerts with Entry Price

Postby beck donald » 09 Apr 2014

I should have mentioned....

That which I showed in my code example, is from an earlier part of this thread. I saw it here asked a question about it and here we are.

thanks

beck donald
Posts: 199
Joined: 25 Jan 2008
Has thanked: 2 times
Been thanked: 7 times

Re: Sending Email Alerts with Entry Price

Postby beck donald » 09 Apr 2014

Got it figured out and working.


Return to “MultiCharts”