Help with this multicharts.net strategy - MultiCharts | futures io social day trading
futures io futures trading


Help with this multicharts.net strategy
Updated: Views / Replies:356 / 1
Created: by alex20037 Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Help with this multicharts.net strategy

  #1 (permalink)
Elite Member
Miami Lakes
 
Futures Experience: Beginner
Platform: Multicharts
Broker/Data: Interactive Brokers
Favorite Futures: Emini ES
 
Posts: 19 since Oct 2016
Thanks: 2 given, 3 received

Help with this multicharts.net strategy

Hi everyone,

I am working on this strategy and need help figuring this out please. The strategy begins with opening up a position either long or short doesn't matter. Set a target profit and a stop loss and send the profit and stop orders right away. If target profit is reached, then exit and wait for another position to be opened (manually). If the stop loss is reached, then it should close the initial position, and then open up twice as many contracts in the opposite direction, and this is where I need help. The stop works fine, but I haven't been able to figure out how to send those twice as many contracts. This is what I have so far.

With this line

stoLongToShort.Send(takeReversePrice,takeReversePrice,orderSize*2);

stoLongToShort is a stop limit order, I am attempting to enter the reverse position, but the order just won't go through. I am sure I am missing something. Please help, thanks in advance.


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

namespace PowerLanguage.Strategy {

[IOGMode(IOGMode.Enabled)]
public class ProfitTaker : SignalObject
{
private IOrderMarket bto,sto;
private IOrderPriced stcProfitLong, btcProfitShort;
private IOrderStopLimit stcStopLong, btcStopShort, stoLongToShort, btoShortToLong;
private double takeProfitPrice, takeReversePrice;

int orderSize = 0;
int maxEntriesInPosition = 10;
int maxOrderSize = 1000;

[Input]
public int ProfitTicks { get; set; }
[Input]
public int StopTicks { get; set; }

public ProfitTaker(object _ctx) : base(_ctx) { }

private bool bracketSet;

protected override void Create() {

bto = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.UserSpecified, "Buy", EOrderAction.Buy));
sto = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.UserSpecified, "SellShort", EOrderAction.SellShort));

stcProfitLong = OrderCreator.Limit(new SOrderParameters(Contracts.UserSpecified, "TakeProfitLong", EOrderAction.Sell));
stcStopLong = OrderCreator.StopLimit(new SOrderParameters(Contracts.UserSpecified, "StopLong", EOrderAction.Sell));
stoLongToShort = OrderCreator.StopLimit(new SOrderParameters(Contracts.UserSpecified, "LongToShort", EOrderAction.SellShort));

btcProfitShort = OrderCreator.Limit(new SOrderParameters(Contracts.UserSpecified, "TakeProfitShort", EOrderAction.BuyToCover));
btcStopShort = OrderCreator.StopLimit(new SOrderParameters(Contracts.UserSpecified, "StopReverseShort", EOrderAction.BuyToCover));
btoShortToLong = OrderCreator.StopLimit(new SOrderParameters(Contracts.UserSpecified, "ShortToLong", EOrderAction.Buy));

ProfitTicks = 24;
StopTicks = 8;
}

protected override void StartCalc() {
Output.Clear();
}

protected override void CalcBar() {

if (StrategyInfo.MarketPosition == 0 && StrategyInfo.MarketPositionAtBroker != 0) {
ChangeMarketPosition(StrategyInfo.MarketPositionAtBroker - StrategyInfo.MarketPosition, StrategyInfo.AvgEntryPriceAtBroker);
Output.WriteLine("{0} - Sync with broker", Bars.Time[0].ToString("d-M HH:mm"));
}

if (StrategyInfo.MarketPosition == 0) {
orderSize = 1;
} else {
orderSize = Math.Min(CurrentPosition.OpenLots, maxOrderSize);
}

if (StrategyInfo.MarketPosition > 0) {

int barsInPosition = Bars.CurrentBar - Positions[0].OpenTrades[0].EntryOrder.BarNumber;
if (barsInPosition == 0) {
takeProfitPrice = Positions[0].OpenTrades[0].EntryOrder.Price + (ProfitTicks * (Bars.Info.MinMove / Bars.Info.PriceScale));
takeReversePrice = Positions[0].OpenTrades[0].EntryOrder.Price - (StopTicks * (Bars.Info.MinMove / Bars.Info.PriceScale));
}

stcProfitLong.Send(takeProfitPrice,orderSize);
stcStopLong.Send(takeReversePrice,takeReversePrice,orderSize);
stoLongToShort.Send(takeReversePrice,takeReversePrice,orderSize*2);

}

if (StrategyInfo.MarketPosition < 0) {

int barsInPosition = Bars.CurrentBar - Positions[0].OpenTrades[0].EntryOrder.BarNumber;
if (barsInPosition == 0) {
takeProfitPrice = Positions[0].OpenTrades[0].EntryOrder.Price - (ProfitTicks * (Bars.Info.MinMove / Bars.Info.PriceScale));
takeReversePrice = Positions[0].OpenTrades[0].EntryOrder.Price + (StopTicks * (Bars.Info.MinMove / Bars.Info.PriceScale));
}

btcProfitShort.Send(takeProfitPrice,orderSize);
btcStopShort.Send(takeReversePrice,takeReversePrice,orderSize);
btoShortToLong.Send(takeReversePrice,takeReversePrice,orderSize*2);

}

}
}
}

Reply With Quote
 
  #2 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,455 since Apr 2013
Thanks: 222 given, 830 received

alex20037,

you might want to add output statements to check that you send the correct prices etc. for the orders.

What do you intend with "OrderCreator.MarketThisBar"? Seeing that you use IOG, is there a reason for not using "OrderCreator.MarketNextBar"? 4.6.9 Advanced. How The Strategy Backtesting Engine works - MultiCharts

I am not saying you shouldn't use it, but if you do, think about how this affects your code. Especially when you check for something like "barsInPosition == 0".

One thing that I would suggest not to do is sending a stop and an entry order (with twice the size) at the same price. Worst case is that you get filled on both and get an overfill - the reverse orders as you have coded them will exit your position and set you short/long twice the amount. On top of that your exit orders close the open position, too. The result in realtime could be that you are long three times the open short position now (or vice versa).

Regards,

ABCTG

Reply With Quote

Reply



futures io > > > > Help with this multicharts.net strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Alternative Views on Traditional Tools w/Rhonda Jones

Elite only

FuturesTrader71: TBA

Elite only

Al Brooks: TBA

Elite only

Jigsaw Trading: TBA

Oct 19

RandBots: TBA

Oct 24
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
strategy with EMA and range - comaprison of codes in MultiCharts /.NET / AmiBroker jamesfisher MultiCharts 0 May 28th, 2016 11:37 AM
Convert code from multicharts(ELD) to Multicharts.NET rmiller863 MultiCharts 4 May 21st, 2016 09:16 AM
Multicharts and MultiCharts.NET 9.1 Beta 2 Aufidius MultiCharts 0 August 24th, 2015 12:05 AM
MultiCharts and MultiCharts.NET 9.1 Beta 1 panz MultiCharts 1 August 5th, 2015 11:47 AM
MultiCharts and MultiCharts .NET: where are indicators more performant? GoSlow MultiCharts 3 February 3rd, 2014 01:33 AM


All times are GMT -4. The time now is 02:52 AM.

Copyright © 2017 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
Page generated 2017-09-21 in 0.10 seconds with 19 queries on phoenix via your IP 54.225.54.120