For convenience WL

Everyone knows how inconvenient the interface of the new WealthLab is sometimes. For example, у нас открыт schedule, but in order to see how many shares (Contracts) and at what price to place an order, we need to go to the Alerts tab, remember the number of shares there (Contracts), order price and go back to the chart to visually see where the order will be. But while you will consider the schedule, already forget the number of shares or the price, или и то и другое. Everything was thought out in the old WealthLab and orders appeared at the bottom of the chart, so there was no need to switch anywhere.

That's why, for convenience, I recommend creating a new panel and placing the order description there, for example like this:

But, interesting, that in the standard way it turned out that orders for opening a position were displayed correctly, and on closing a position, the price was always zero. I had to write to the WealthLab forum, where quickly got a response from Eugene (this is their main representative) that it will not work directly, because something is wrong with them, but you can turn everything around in a roundabout way. And gave an example code.
http://www.wealth-lab.com/Forum/Posts/Alert-BasisPrice-is-zero-for-sell-orders-35546

Everything seems to be working fine. Just one minor snag now. If you test futures, then, as before, orders to open a position are displayed normally, but something like this turns out to close a position:

Sell 1 contract of ES at Stop 2097.826256522141421

It would be more correct, of course so:

Sell 1 contract of ES at Stop 2097.75

Because the price step for ES futures — 0,25.

If interesting, I give the code. System example — buy on the breakdown of the two-bar channel at high, sell for the breakdown of the two-bar channel at low. The rest of the code for displaying the order in the top panel:

  Alibaba report: revenue is growing, but investors are not happy

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies
{
   public class MyStrategy : WealthScript{
      protected override void Execute()
      {
         ChartPane zPane = CreatePane( 10, true, true );
         Font font = new Font("Arial", 10, FontStyle.Regular);
         
         for(int bar = 20; bar < Bars.Count; bar++)
         {
            if (IsLastPositionActive)
            {
               Position p = LastPosition;
               double exitPrice = Lowest.Value(bar, Low, 2);
               per day = (object)exitPrice;
               SellAtStop(bar+1, p, exitPrice);
            }
            else
            {
               BuyAtStop(bar+1, Highest.Value(bar, High, 2));
            }
            for( int i = 0; i < Alerts.Count; i++ )
            {
               WealthLab.Alert a = Alerts[i];
               bool exit = (a.AlertType == TradeType.Sell || a.AlertType == TradeType.Cover);
               string basis = exit == true ? ((double)a.Position.Tag).ToString() : a.BasisPrice.ToString();
               DrawText( zPane, a.AlertType + " " + a.Shares + " contracts of " + a.Symbol + " at " + a.OrderType + " " + basis, 
                  0, 0, Color.White, Color.Black, font);
            }
         }
      }
   }
}
Scroll to Top