NexusFi: Find Your Edge


Home Menu

 





How to abstract a functionality so it can run multiple strategy orders using ACSIL?


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one bradhouser with 1 posts (0 thanks)
    2. looks_two doetrader with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 LittleFinger with 1 posts (1 thanks)
    1. trending_up 1,070 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

How to abstract a functionality so it can run multiple strategy orders using ACSIL?

  #1 (permalink)
doetrader
Atlanta, Georgia, USA
 
Posts: 19 since Dec 2018
Thanks Given: 2
Thanks Received: 0

I have an idea on how to implement certain part of my strategy, but I'm not sure how to go about implementing it.

From: www dot sierrachart dot com/ index.php?page=doc/ACSIL_Members_Variables_And_Arrays.html#scVolumeAtPriceForBars

Say I have the following code below (not sure if it is completely correct, but I am trying to get the idea though):

 
Code
sc.VolumeAtPriceForBars->GetVAPElementAtPrice(sc.Index, scPriceValueToTicks(2450.75))
I want to be able to get the bid volume for that price in the current bar. Based off of that, I want to check if the bid volume is 200 or more. If it is, I want to send a strategy order directly coded in ACSIL (a parent order with attached orders--basically a bracket orders and stops.)

An order of such description could be open for many bars, however, my study could also open many many orders (up to 1000) that each span over many bars.


How would I go about keeping track of all those orders? How would I abstract things so that, if a certain condition happens, the study would go and update one or more of those orders depending on what I want (it could be canceling, changing price up or down, or quantity).

Has anyone perhaps done something resembling this that I can look at their code?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
NexusFi Journal Challenge - May 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #3 (permalink)
bradhouser
Northern California where the girls are warm
 
Posts: 122 since Nov 2010
Thanks Given: 15
Thanks Received: 72


Once a parent order is filled, the orderid is read from the NewOrder object, it needs to be kept in a persistent variable for future use.

 
Code
int ParentInternalOrderID = NewOrder.InternalOrderID;

Let's save that as persistent integer 1:

 
Code
sc.GetPersistentInt(1) = ParentOrderID;

Later on you can read the persistent integer and cancel it:

 
Code
sc.CancelOrder(sc.GetPersistentInt(1));

Reply With Quote
  #4 (permalink)
 
LittleFinger's Avatar
 LittleFinger 
Denver Colorado/USA
 
Experience: Intermediate
Platform: SierraChart
Broker: AMP
Trading: ES
Posts: 116 since May 2017
Thanks Given: 132
Thanks Received: 145


doetrader View Post
I have an idea on how to implement certain part of my strategy, but I'm not sure how to go about implementing it.

From: www dot sierrachart dot com/ index.php?page=doc/ACSIL_Members_Variables_And_Arrays.html#scVolumeAtPriceForBars

Say I have the following code below (not sure if it is completely correct, but I am trying to get the idea though):

 
Code
sc.VolumeAtPriceForBars->GetVAPElementAtPrice(sc.Index, scPriceValueToTicks(2450.75))
I want to be able to get the bid volume for that price in the current bar. Based off of that, I want to check if the bid volume is 200 or more. If it is, I want to send a strategy order directly coded in ACSIL (a parent order with attached orders--basically a bracket orders and stops.)

An order of such description could be open for many bars, however, my study could also open many many orders (up to 1000) that each span over many bars.


How would I go about keeping track of all those orders? How would I abstract things so that, if a certain condition happens, the study would go and update one or more of those orders depending on what I want (it could be canceling, changing price up or down, or quantity).

Has anyone perhaps done something resembling this that I can look at their code?

I coded a system that uses 3 orders and different stop management rules for each order. Here's some description from the code:

//after 8 ticks profit, the stop is raised to -3 ticks from our entry point
//at 17 profit, move up stop on one contract to entry point +10 ticks
//once we are +40, move the 50 target contract stop up to +25 ticks, leave the 80 tick target contract stop at breakeven
//after 68 ticks, the 80 tick target contract's stop is moved to +50

I am very rusty on ACSIL right now because I haven't used it for a few months, but I'm happy to share my code with you so you can learn from my methods.

I haven't tested this with live trading, but it works well in simulation. I've found it to be profitable during certain times for certain markets in certain conditions.

This system enters a trade once a breakout from a time-defined range occurs. There's no secret edge in this code, but the methods used in it could apply to many different trading systems.

Checking the volume as a condition for trade entry shouldn't be difficult.

I would become very familiar with this:
https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Variables_And_Arrays.html

Send me a PM if you are interested in the code

-LF

Reply With Quote
Thanked by:




Last Updated on October 12, 2019


© 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