NexusFi: Find Your Edge


Home Menu

 





EasyLanguage one trade a day


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one ABCTG with 7 posts (2 thanks)
    2. looks_two nimrodc with 6 posts (0 thanks)
    3. looks_3 kevinkdog with 1 posts (1 thanks)
    4. looks_4 SMCJB with 1 posts (2 thanks)
    1. trending_up 6,720 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 16 posts
    2. attach_file 0 attachments




 
Search this Thread

EasyLanguage one trade a day

  #11 (permalink)
nimrodc
israel
 
Posts: 7 since Jan 2018
Thanks Given: 3
Thanks Received: 0

what i am seeing in the debug is that
not only for the first bar of the day date <>date[1]
but also on all others bars

i am checking the values of date and date[1] and for all bars of the day
date show the date for today
date[1] show the date for yesterday

i thought date should show the date for current bar and date[1] should show the date for previous bar

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
 
  #12 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

nimrodc,

you would have to post the code snippet you use to check this and the chart timeframe you are applying this to.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #13 (permalink)
nimrodc
israel
 
Posts: 7 since Jan 2018
Thanks Given: 3
Thanks Received: 0



ABCTG View Post
nimrodc,

you would have to post the code snippet you use to check this and the chart timeframe you are applying this to.

Regards,

ABCTG

this is the code

variables:
debug (0),
IntraBarPersist tradesCounter(0);

debug = 1;

[IntraBarOrderGeneration = TRUE]

If Date <> Date[1] then begin
tradesCounter = 0;
Value1 = date;
Value2 = date[1];
if debug = 1 then Breakpoint("checkpoint-1");
end;

i am debugging on SPY 15 min chart

thanks!

Reply With Quote
  #14 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

nimrodc,

I am not sure what you are seeing, but I only see this code executed on the first bar of the date in the debugger.
You can confirm this via the EasyLanguage Print Log by changing your code line with the Breakpoint to
something like: if debug = 1 then Print( BarDateTime.ToString(), "; I am here" ) ;

As the condition Date<>Date1[1] is true on the entire first bar, you will see multiple prints for each first bar of the day. This can be overcome by using an intrabarpersist variable that stores the current date, when Date <> this variable.
Something along the lines of:
 
Code
if Date <> oldDate then
begin
oldDate = Date;
tradeCounter = 0;
end;
Regards,

ABCTG


nimrodc View Post
this is the code

variables:
debug (0),
IntraBarPersist tradesCounter(0);

debug = 1;

[IntraBarOrderGeneration = TRUE]

If Date <> Date[1] then begin
tradesCounter = 0;
Value1 = date;
Value2 = date[1];
if debug = 1 then Breakpoint("checkpoint-1");
end;

i am debugging on SPY 15 min chart

thanks!


Follow me on Twitter Reply With Quote
Thanked by:
  #15 (permalink)
JBroex
Istanbul
 
Posts: 35 since Sep 2020
Thanks Given: 24
Thanks Received: 19


SMCJB View Post
Or, put the counter inside the loop that gets you into the first trade.

 
Code
variables: tradesCounter(0);

[IntraBarOrderGeneration = TRUE]

If Date <> Date[1] then tradesCounter = 0;

If (marketposition = 0 and tradesCounter = 0) then begin 
    Buy ("BUY-LONG") next bar at market;
    tradesCounter = 1
end;

If marketposition = 1 then Sell ("STOPLOSS") next bar at EntryPrice - 0.5 Stop;

Just a question, if you only want to take one trade per day, do you need the tradescounter variable?
Can you just not use MP by itself?, for example only take a trade when MP = 0

Thanks!

Reply With Quote
  #16 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

JBroex,

if your strategy exits (during the day) MarketPosition would return 0 again. Using MarketPosition alone might not effectively limit the strategy to one trade a day.

Regards,

ABCTG


JBroex View Post
Just a question, if you only want to take one trade per day, do you need the tradescounter variable?
Can you just not use MP by itself?, for example only take a trade when MP = 0

Thanks!


Follow me on Twitter Reply With Quote
  #17 (permalink)
dbreen1
San Antonio
 
Posts: 8 since Feb 2020
Thanks Given: 1
Thanks Received: 12

It should depend on whether your trying to trade only during margin times ( 0700 to 1500 ) or if your holding from 0000 to 2459. If your trying to buy at session open the problem is the futures sessions begin at 1600 and carry over into the next day so using date RW alone wont work. if your trying to close out during normal hours try if time < 1459 then. nut im not sure exactly when you want to buy in and out

Reply With Quote




Last Updated on January 12, 2021


© 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