- ago
Is it possible to display the last closing price of the underlying share when the signal is issued? Can this be programmed in C#? If so, which line of code and where in the strategy code? It would be great if someone could help me :-)
0
111
7 Replies

Reply

Bookmark

Sort
- ago
#1
QUOTE:
Is it possible to display the last closing price of the underlying share when the signal is issued?

The signal typically applies to the next (or forthcoming, off-the-Chart) bar, so are you asking to display the closing price of the previous (or last Chart) bar?

You can just mouse over the previous (last Chart) bar to get its Closing price you know. Is there something special you want to do in code with that last-bar Closing price? Have you tried to activate the "Data Panel" from the View menu to see the different indicator values (such as the Closing price of a particular bar)?

Now both the streaming Chart and the streaming Quotes window display the "current" price. The Quotes window also shows the price change (in both dollars and percent change) from the previous Close to the current price.

QUOTE:
Can this be programmed in C#?

For non-trading Chart display stuff, you'll probably need to use code. But I think what you want can be displayed in the Data Panel.
0
- ago
#2
I wanted to see the last close displayed with the signals, as I always transfer certain data to Excel. At the moment, I always do this via the chart window and get the close of the last candle there. However, this is a bit cumbersome. If the close were displayed directly with the signals, it would make my work a little easier.
0
- ago
#3
QUOTE:
wanted to see the last close displayed with ... signals [to] transfer ... to Excel.

So you're copying this Signal data from Strategy Monitor. In that case, I would simply prepend the last Close to the Signal message like so.
CODE:
   public override void Execute(BarHistory bars, int idx)    {       if (HasOpenPosition(bars, PositionType.Long))       {          //sell conditions below          if (...)             PlaceTrade(bars, TransactionType.Sell, OrderType.Market, 0.0, bars.Close[idx].ToString("N2") + " Sell order");       }       else       {          //buy conditions below          if (...)             PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0.0, bars.Close[idx].ToString("N2") + " Buy order");       }    }
It might have been better to give me your Execute code to modify, but you can probably figure it out from above.

Alternatively, you could have your C# code simply write the relevant stuff directly to the Clipboard for Excel to pick up. You might want to create a custom C# function or class for doing that. I'm wondering what you're doing in Excel that the Analysis Series or Position Metrics Performance Visualizers can't already do for you?
0
- ago
#4
@Superticker Thank you very much for your help, it works :-) The close is directly in front of the name of the signal:



Is it possible to insert an extra column?
0
- ago
#5
QUOTE:
Is it possible to insert an extra column?

You mean an extra space? Yes, I did that in my example. Notice the " " in front of the "Buy order" string below.
CODE:
PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0.0,bars.Close[idx].ToString("N2") + " Buy order");
You can add several " " spaces if you want in a C# string.
CODE:
... + " " + ...
If you need to, post your PlaceTrade statement and I'm fix it. When asking for coding help, you should include starting code with your question.
0
- ago
#6
Thank you. I meant a column, like the ‘Signal Name’ column in the image above.
0
- ago
#7
QUOTE:
I meant a column, like the ‘Signal Name’ column in the image above.

No, you can't add columns to the Strategy Monitor output. You would have to change the Strategy Monitor WPF code to do that, which we don't have access to.

You could write your own *.csv file to the Clipboard (originally suggested) or to disk. That's a bit more complicated and you would have to be doing your strategy entirely in C#. The more customization you want to do, the more you need to be coding in C#.
0

Reply

Bookmark

Sort