NexusFi: Find Your Edge


Home Menu

 





Market Position shows no change


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
JBroex
Istanbul
 
Posts: 35 since Sep 2020
Thanks Given: 24
Thanks Received: 19

Hi everyone,

I coded a simple strategy where I want to draw lines for a trailing stop.
Since I dont have any lines on the graph, I checked the print log. There it seems that even when I enter a long trade, the market position doesnt turn to 1.
Since I have a trailing stop, I suspect that the long trade is stopped out immediately, but even when I put the stop very large nothing shows up.
Whats wrong here? Hope you guys can help!

Thanks!

This is my code


input: NumTicks(10),
Length(14);
Vars: Avg(0),
TickVal(MinMove/PriceScale),
Trail(0),
MP(0);

MP = Marketposition;
Avg= Average(Close,Length);

if Close crosses over Avg then Buy next bar at market;
TL_New(d[1],t[1],Avg[1],d,t,Avg);

Setdollartrailing (NumTicks * TickVal * Bigpointvalue);


if MP = 1 Then
Begin
Trail = maxlist(Trail, Low - (NumTicks*TickVal));
Value1 = TL_new(d[1],t[1],Trail[1],d,t,Trail);
Value3 = Text_New(d,t,Trail,"*");
end;

if MP = 0 then Trail = 0; [/COLOR]


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Memorandum Watch: How the 60-Day MOU Framework Makes May …
Prediction Markets & Event Contracts
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
$500M Riding on World Cup 2026: France/Spain Co-Favored …
Prediction Markets & Event Contracts
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
 
  #2 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
Legendary Systematic Algo Trader
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,270 since Feb 2017
Thanks Given: 2,960
Thanks Received: 2,856

I just tried your code (TS v10) and it works for me on a 25 tick and 1 minute RB charts:




Here is the code I used (I commented out the things I believe are your custom functions):


input:
NumTicks(10),
Length(14);


Vars:
Avg(0),
TickVal(MinMove/PriceScale),
Trail(0),
MP(0);

MP = Marketposition;
Avg= Average(Close,Length);

if Close crosses over Avg then Buy next bar at market;

//TL_New(d[1],t[1],Avg[1],d,t,Avg);

Setdollartrailing (NumTicks * TickVal * Bigpointvalue);


if MP = 1 Then
Begin
Trail = maxlist(Trail, Low - (NumTicks*TickVal));
//Value1 = TL_new(d[1],t[1],Trail[1],d,t,Trail);
//Value3 = Text_New(d,t,Trail,"*");
end;

if MP = 0 then Trail = 0;


~vmodus

Enjoy everything!
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
Legendary Systematic Algo Trader
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,270 since Feb 2017
Thanks Given: 2,960
Thanks Received: 2,856


.... one more thing my wife mentioned regarding the setdollartrailing function: make sure to set 'Use Look-Inside-Bar Back-testing' in the Strategy Properties, otherwise your results will look too good to be true, and rightly so. We use 1 minute in our settings for our time-based charts.

I hope this helps.


~vmodus

Enjoy everything!
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
JBroex
Istanbul
 
Posts: 35 since Sep 2020
Thanks Given: 24
Thanks Received: 19


vmodus View Post
.... one more thing my wife mentioned regarding the setdollartrailing function: make sure to set 'Use Look-Inside-Bar Back-testing' in the Strategy Properties, otherwise your results will look too good to be true, and rightly so. We use 1 minute in our settings for our time-based charts.

I hope this helps.


Dear Vmodus, sorry for the late reply but this really helped!
Especially the advice about the look inside bar back testing, your wife is a tradestation coder too? That must be awesome both of you doing the same at home!


Reply With Quote
Thanked by:
  #5 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
Legendary Systematic Algo Trader
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,270 since Feb 2017
Thanks Given: 2,960
Thanks Received: 2,856


JBroex View Post
Dear Vmodus, sorry for the late reply but this really helped!
Especially the advice about the look inside bar back testing, your wife is a tradestation coder too? That must be awesome both of you doing the same at home!

You're welcome. It does help to have two brains on some of the problems we try to solve. Sometimes it works, too.


~vmodus

Enjoy everything!
Follow me on X Visit my NexusFi Trade Journal Reply With Quote




Last Updated on October 14, 2020


© 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