trade closed in the same bar .. was it long or short?
trade closed in the same bar .. was it long or short?
Use Marketposition is not corret because it returns the value zero
How can i code it?(i don't use intrabar generation)
- ABC
- Posts: 723
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: trade closed in the same bar .. was it long or short?
shivax,
take a look at the strategy position trades keywords:
https://www.multicharts.com/trading-sof ... ion_Trades
PosTradeIsLong could for example tell you if a trade was long or short.
Regards,
ABC
take a look at the strategy position trades keywords:
https://www.multicharts.com/trading-sof ... ion_Trades
PosTradeIsLong could for example tell you if a trade was long or short.
Regards,
ABC
Re: trade closed in the same bar .. was it long or short?
PosTradeIsLong(PosAgo, TradeNumber
Tradenumber what is ? I dont understand
Tradenumber what is ? I dont understand
- ABC
- Posts: 723
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: trade closed in the same bar .. was it long or short?
shivax,,
TradeNumber is the (zero based) number of individual entries into the position for the specific trade and you can use PosTradeCount to retrieve it.
If you don't scale in and out of trades, it should always be 0.
Regards,
ABC
TradeNumber is the (zero based) number of individual entries into the position for the specific trade and you can use PosTradeCount to retrieve it.
If you don't scale in and out of trades, it should always be 0.
Regards,
ABC
Re: trade closed in the same bar .. was it long or short?
are you sure PosTradeislong run correctly?
i try this example :
i see all print =True
https://gyazo.com/6da22860acd84ee78125b0597a4ff603
i try this example :
Code: Select all
....
if Time=1000 then sellshort next bar at open;
print(Date,time," ",PosTradeislong(0,1));
https://gyazo.com/6da22860acd84ee78125b0597a4ff603
- ABC
- Posts: 723
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: trade closed in the same bar .. was it long or short?
shivax,
what is your rational for setting TradeNumber to 1?
Regards,
ABC
what is your rational for setting TradeNumber to 1?
Regards,
ABC
are you sure PosTradeislong run correctly?
i try this example :
i see all print =TrueCode: Select all
....
if Time=1000 then sellshort next bar at open;
print(Date,time," ",PosTradeislong(0,1));
https://gyazo.com/6da22860acd84ee78125b0597a4ff603
- signalworks
- Posts: 65
- Joined: 06 Oct 2013
- Location: Germany.Solingen
- Has thanked: 23 times
- Been thanked: 2 times
- Contact:
Re: trade closed in the same bar .. was it long or short?
shivax,
Another possibility: if you name your entries that way:
then you can use
to determine the name of the last closed trade. Hope this helps.
regards.
Another possibility: if you name your entries that way:
Code: Select all
buy ("PosName_Long") ...
sell short ("PosName_Short")...
Code: Select all
PosTradeEntryName(PosAgo,TradeNumber)
Where: PosAgo - a numerical expression, specifying the position:
0 - open position;
1 - one position back (the last position closed);
2 - two positions back, etc.
TradeNumber - a numerical expression, specifying the number of trade (zero-based).
regards.