Coding problem, Multicharts.net, Using function entry point values as exit point | Traders Hideout


futures.io - futures trading strategies, market news, trading charts and platforms


Traders Hideout


Discuss day trading practices and futures trading strategies on this forum for all markets. This forum is also for discussing and reviews for brokers, data feeds, and commercial or third party add-ons




 

Coding problem, Multicharts.net, Using function entry point values as exit point

  #11 (permalink)

Toronto Canada
 
 
Posts: 9 since Jan 2018
Thanks: 5 given, 1 received

I made a mistake the correct code is

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

namespace PowerLanguage.Strategy {
[IOGMode(IOGMode.Disabled)]

public class working_signal : SignalObject {

private IOrderMarket buy_exit;
private IOrderMarket sell_exit;
private function_profit_target value;
private int counter;



public working_signal(object _ctx):base(_ctx)
{

counter = 0;








}
protected override void Create() {
// create variable objects, function objects, order objects etc.
buy_exit = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.Default, EOrderAction.Sell));
sell_exit = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.Default, EOrderAction.BuyToCover));
value = new function_profit_target(this);
}
protected override void StartCalc() {
// assign inputs




}
protected override void CalcBar()
{

if (CurrentPosition.Side == EMarketPositionSide.Long)
{
counter = counter + 1;
if ((Bars.Close[0] - this.EntryPrice(0)) >= (value[counter]))
{
buy_exit.Send();
counter = 0;
}
}
else if (CurrentPosition.Side == EMarketPositionSide.Short)
{
counter = counter + 1;
if ((Bars.Close[0] - this.EntryPrice(0)) <= ((-1) * value[counter])
{
sell_exit.Send();
counter = 0;
}
}

}
}
}
_______________________________________________________________________________________________
_______________________________________________________________________________________________

Reply With Quote