NexusFi: Find Your Edge


Home Menu

 





How to check type of exit: stop or take?


Discussion in MultiCharts

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




 
Search this Thread

How to check type of exit: stop or take?

  #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?
Better Renko Gaps
The Elite Circle
What broker to use for trading palladium futures
Commodities
Quantum physics & Trading dynamics
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
22 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
ApexTraderFunding.com experience and review
15 thanks
GFIs1 1 DAX trade per day journal
12 thanks
EG Indicators
11 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

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 Twitter Reply With Quote
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


Dzam,

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

Regards,

ABCTG

Follow me on Twitter 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,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

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 Twitter Reply With Quote
Thanked by:




Last Updated on May 8, 2016


© 2024 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 - Privacy Policy - Downloads - Top
no new posts