Help for a simple entry strategy - futures io
futures io



Help for a simple entry strategy


Discussion in MultiCharts

Updated
    1. trending_up 755 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Help for a simple entry strategy

(login for full post details)
  #1 (permalink)
r41866
Cypress Texas/USA
 
 
Posts: 10 since Mar 2021
Thanks: 0 given, 1 received

I want to write a simple entry strategy for Multicharts.Net. Just calculate the current bar's height and determine whether it is a bullish bar. If the bar is bullish and closed above 60% of the height, place a stop order one tick above the high of the current bar. The risk per futures contract will be the height of the current bar plus 2 ticks. The input value is the total risk tolerated per trade in dollar value and the risk tolerated per futures contract in dollar value. If the risk is larger than the risk tolerated per futures contact, there is no trade. If the risk calculated according to the bar height plus two ticks is less than the risk tolerance, the number of contracts for the order is the total risk tolerance divided by the risk per contract and rounded down.

Below is the code I wrote. Yet after I applied the code to ES futures symbol, the order was never triggered. I used Output.WriteLine to debug and I found something weird. I use CurrentPosition.Value to know the current open position and the order is submitted only if there is no open position. Yet I found CurrentPosition.Value is 4 most of the times even if there is nothing open. The CurrentPosition.Value is 0 only when the time is 8:33 pm US central standard time on Jan 27, 2021. The chart I use is a 2000 tick chart. If I use StrategyInfo.MarketPosition to detect the market open position, I get the value exactly the same as CurrentPosition.Value. Please advise what's gone wrong.

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;


namespace PowerLanguage.Strategy
{
[IOGMode(IOGMode.Disabled)]
public class MackBuyStop_Open : SignalObject
{
// Create the inputs
[Input]
public double Max_Risk { get; set; }

[Input]
public double PerContract_Risk { get; set; }

public MackBuyStop_Open(object _ctx) : base(_ctx)
{
// Give the inputs a default value
Max_Risk = 950;
PerContract_Risk = 300;

}

private IOrderPriced enterLong;
private double TickValue, PointValue, BarRisk;


protected override void Create()
{
// Create the orders
enterLong = OrderCreator.Stop(new
SOrderParameters(Contracts.UserSpecified, EOrderAction.Buy));



}

protected override void StartCalc()
{
TickValue = Bars.Info.MinMove / Bars.Info.PriceScale ;
PointValue = Bars.Info.BigPointValue ;
Output.Clear();

}

protected override void CalcBar()
{

BarRisk = ( Bars.High[0] - Bars.Low[0] + 2 * TickValue ) * PointValue ;


if ((CurrentPosition.Value == 0) &&
( Bars.Close[0] - Bars.Open[0] > 0 ) &&
( (Bars.Close[0] - Bars.Low[0] ) / (Bars.High[0] - Bars.Low[0]) >= 0.6 ) &&
( BarRisk <= PerContract_Risk )) //((double)(Bars.High - Bars.Low) + 2 * TickValue)
{
Output.WriteLine(Bars.Time[0].ToString("d-M HH:mm:ss")+" Market Position = {0}\n", CurrentPosition.Value);
if (BarRisk <= PerContract_Risk)
{
enterLong.Send(Bars.High[0] + TickValue, (int)(Max_Risk/BarRisk));

}

}


}
}
}

Reply With Quote


futures io Trading Community Platforms and Indicators MultiCharts > Help for a simple entry strategy


Last Updated on March 14, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts