NexusFi: Find Your Edge


Home Menu

 





How to check type of exit: stop or take?


Discussion in MultiCharts

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




 
Search this Thread
  #1 (permalink)
Dzam
Barcelona
 
Posts: 8 since Dec 2015
Thanks Given: 3
Thanks Received: 1

I am using simple strategy logic. If last position closed by stop, i need to do some action, if it closed by take, than other actiom. But how can i check of closing type?
Multicharts.Net 9.1 (Build 12611)


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
No book, only a stair: journaling fills where price move …
Cryptocurrency
EA
Platforms and Indicators
My Rant with AMP Futures
Trading Reviews and Vendors
Datafeed for Atas
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
BERN ALGOS algo trading journal
3 thanks
NexusFi site changelog and issues/problem reporting
2 thanks
TopStep Trader disappointment
2 thanks
Want your NinjaTrader indicator created, free?
1 thanks
Running trading strategies on a VPS
1 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

Dzam,

depending on how you name your orders, you could check for the order name of the last closed trade. You could also check for the entry and exit price and use that to derive what order was used to close the trade.

Regards,

ABCTG


Follow me on X Reply With Quote
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


Dzam,

you should find all information needed in here: Multicharts.NET Programming Guide.

Regards,

ABCTG


Follow me on X Reply With Quote
  #4 (permalink)
Dzam
Barcelona
 
Posts: 8 since Dec 2015
Thanks Given: 3
Thanks Received: 1


ABCTG View Post
Dzam,

you should find all information needed in here: Multicharts.NET Programming Guide.

Regards,

ABCTG

I have read this guide, but have not find answers...
There is my code:

 
Code
using PowerLanguage.Function;

namespace PowerLanguage.Strategy {
	public class TestStrat : SignalObject {
		public TestStrat(object _ctx):base(_ctx){}
		
        private IOrderStopLimit enter_long_slimit;
        private IOrderStopLimit enter_short_slimit;
        double bar_size;

        protected override void Create()
        {
            enter_long_slimit = OrderCreator.StopLimit(new SOrderParameters(EOrderAction.Buy, "LSEntry"));

            enter_short_slimit = OrderCreator.StopLimit(new SOrderParameters(EOrderAction.SellShort, "SSEntry"));
        }

        protected override void StartCalc()
        {
            Output.Clear();
        }
		protected override void CalcBar()
        {
            Output.WriteLine("EntryPrice = {0}, ExitPrice = {1}, ExitTime = {2}", this.EntryPrice(0), this.ExitPrice(0), this.ExitTime(0));

            if (StrategyInfo.MarketPosition != 0)
            {
                GenerateProfitTargetPt(10);
                GenerateStopLossPt(5);
            }
            else
            {
                bar_size = Bars.High[1] - Bars.Low[1];
                if(bar_size > this.AverageTrueRange(150, 1) / 100 * 200)
                {
                    if(Bars.Close[0] > Bars.Open[0])
                    {
                        enter_long_slimit.Send(Bars.High[0], Bars.High[0]);
                    }
                    else
                    {
                        enter_short_slimit.Send(Bars.Low[0], Bars.Low[0]);
                    }
                }
            }
		}
	}
}
And this is what i have in the output window:

 
Code
EntryPrice = 2061,75, ExitPrice = 0, ExitTime = 01.01.0001 0:00:00
EntryPrice = 2061,75, ExitPrice = 0, ExitTime = 01.01.0001 0:00:00
EntryPrice = 2061,75, ExitPrice = 0, ExitTime = 01.01.0001 0:00:00
EntryPrice = 0, ExitPrice = 0, ExitTime = 01.01.0001 0:00:00
ExitPrice alltime is = 0.

CurrentPosition.ClosedTraders - alltime is empty, but CurrentPosition.OpenTrades is filling after open new position.


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

Dzam,

if you are dealing with closed positions Currentposition might not help you and you can access the information you need via Positions[].

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:




Last Updated on May 8, 2016


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts