Ninjatrader strategies

C# Прочее Forex C# OpenCL

Техническое задание

3B Strategy

Overview

While the spec breaks this down into step by step details, the model itself is low complexity, as its all done within 3 candles and simple exit criteria (no scaling, etc), intentionally done so for short time to market and management.


Assumptions:

  1. The strategy should run for one-to-many accounts, ideally avoiding a trade copier and keeping all control in our code.

  2. Multiple trades can be live at once and are independent of any other trade. (meaning we could be both long and short the same instrument).



  1. 3 candle pattern Setup: We will have a 3 candle pattern that this strategy is based on - for our purposes we will refer to those 3 candles as C1, C2, C3.   

    1. C1 - Order Block (OB) as defined in below spec. 

    2. C2 - The close of this candle determines if C1 is an OB or not, details below.

    3. C3 - in this strategy only C3 can be the Entry candle - Entry order would be at the opening price of the order block (C1).


  1. Orderblock identification logic (C1):

    1. Bullish OB : A candle is identified as Bullish OB if it closes lower than its open (meaning the Bullish OB is a red candle itself), followed by a subsequent candle (C2) closing above the high of the OB candle (meaning for Bullish OB, C2 is a green candle)

    2. Bearish OB: A candle is identified as Bearish OB if it closes higher than its open (meaning the Bearish OB is a green candle itself), followed by a subsequent candle (C2) closing below the low of the OB candle (meaning for Bearish OB, C2 is a red candle)


  1. Entry Conditions (C3) - Once the OB is identified, and OCO order should be placed that exists only for the life of this C3 candle.  If the trade is not triggered before the C3 candle closes, then the OB candle is no longer active for trading the 3B setup and the order is canceled.  

    1. For Bullish OBs 

      1. Order Type:  OCO - one cancels the other

      2. Direction:  Long

      3. Entry Price = OB (C1) Open 

      4. Stop:  Lowest low of C1/C2.

      5. Exit Target:  1R.   (ex. If we enter long at 100, stop at 90, target would be 110)

      6. Size (Number of Contracts):  Percent  of Account size will be used to calculate the number of contracts to enter. This is defaulted to 10%   See Appendix for Size calculation details for each instrument.

    2. For Bearish OBs  

      1. Order Type:  OCO - one cancels the other

      2. Direction:  Short

      3. Entry Price = OB (C1 Open

      4. Stop:  Highest high of C1/C2.

      5. Exit Target:  1R.   (ex. If we enter short at 100, stop at 120, target would be 80)

      6. Size (Number of Contracts):  Percent  of Account size will be used to calculate the number of contracts to enter. This is defaulted to 10%   See Appendix for Size calculation details for each instrument.



  1. TimeFrames and instruments in scope:  we will want to apply this setup to a number of tickers and timeframes for those tickers.  Whether that is best achieved by setting up this strategy one by one for each ticker/time frame combination, or if this one script can be configured for all the combinations is TBD based on the preference would be for whichever provides a more stable/high performing result.. Most probably the time frames are 5 Minutes, 15 Minutes and 1 Hour


  1.  Protection Features - as we are dealing with trading, we need to have robust protection features in place to ensure we dont get run-away behaviors. As such we need to place parameters is for:

    1. Max allowable trade Size - a dollar figure set by the user, default is $10000



Appendix

Trade Size Calculation (number of contracts):

We will calculate trade size based on percentage of total account size, ex. 10% of account size.  This will give us a dollar value of what we have as maximum (max) risk. 


We will then take this max risk number and use it to calculate the number of contracts to trade based on the instrument and the matrix below.


Detailed Steps:

  • 1. Requesting Account Size:

  • 2. Determining Max Trade Size:

    • Calculate the dollar amount to risk by multiplying the account size by the user-defined percentage, Ex 10%

  • 3. Instrument-Specific Calculation:

    • For each trade, use the calculated dollar amount to risk, along with the instrument's tick size and tick value, to determine the number of contracts or shares to trade.

    • The formula for this calculation is: 

      • Trade Size (Number of Contracts = Dollars risk per Trade / (Stop size in Tricks * Tick Value)

 

Instrument/Tick Size/Tick Value Matrix:

Instrument

Tick Size

Tick Value (USD)

MES (Micro E-mini S&P 500 Futures)

0.25

$1.25

MNQ (Micro E-mini NASDAQ-100 Futures)

0.25

$0.50

MCL (Micro Crude Oil Futures)

0.01

$0.10

MGC (Micro Gold Futures)

0.10

$1.00

M2K (Micro E-mini Russell 2000 Futures)

0.10

$0.50

MYM (Micro E-mini Dow Jones Futures)

1.00

$0.50


Example calculation:

To calculate the number of contracts to trade for the MNQ (Micro E-mini NASDAQ-100 Futures) with a $100 maximum risk size,  and a 10 tick stop size, we'll use the formula for trade size:

Let's define:

  • Dollar Risk per Trade: $100

  • Stop Size in Ticks: We'll need to define this based on your strategy. For this example, let's assume a stop size of 10 ticks.

  • Tick Value for MNQ: $0.50 per tick

Given these values, we can calculate the number of MNQ contracts to trade to not exceed a $100 risk.

Let's perform this calculation

Based on the given parameters ($100 maximum risk size, 10 tick stop size, and a tick value of $0.50 for MNQ), you would trade 20 contracts of the MNQ (Micro E-mini NASDAQ-100 Futures) to not exceed a $100 risk.




Example 1: Bullish OB Entry, Target hit. 

March 22, 2024, 4:05am EST, 5 minute chart



Example 2: Bearish OB Entry, Target hit.

March 21, 2024, 12:25pm EST, 5 minute chart



Example 3: Bullish OB Entry, Trade failed, Stop Hit:

March 22, 2024, 10:40am EST, 5 minute chart


Example 4: Bearish OB Entry, Trade failed, Stop Hit:

March 22, 2024, 13:30pm EST, 5 minute chart



Похожие заказы
Build an EA based on Heikin-Ashi candles and two indicators attached, Midnight Hunter and Linear regression trend channel. In the settings of the indicators I only need to be able to set the period for the LRTC in the EA, the default being set to 100. The bearish trade is entered if 1. bearish engulfing candle (indicated by red flag, 'beeng' in the code) has crossed the Upper Lrtc line to the downside. LRTC has an
je vous envoie ce messages car j'ai une stratégie de trading mais je n'arrive pas à la créer , Les condtions: LONG si l'indicateur LSMA croise hull suite de couleur verte et que la valeur du marché est supérieure à celle des 2 indicateur il faut acheter SELL si l'indicateur LSMA croise hull suite de couleur rouge et que la valeur du marché est inférieure à celle des 2 indicateur il faut acheter SL dernier swig high
Hello, I am looking for an experienced MQL5 developer who can review and correct my existing 10 MetaTrader 5 utilities. Currently, some of my utilities are encountering errors, including "undeclared identifier" and other general issues. I need someone who can identify, rectify these errors, and ensure that all 10 utilities function properly. Requirements: Experience with MQL5 programming and MetaTrader 5 Ability to
I Want a bot that will work for my tradingview strategy and also works perfectly, Kindly reach out to me so I can explain the project more further and get started without any further delay
Looking for EA's that can pass prop firms Only message me if you are serious thank you https://t.me/ marketkillerrr Message me on tele^Gram thanks Or you can msg me here it doesn't matter please do not waste my time... Price is negotiable i can pay up to 30,000$
An expert is required based on a specific index of the market The expert does the following Opens 0.01 micro lot per $1000 A buy trade is opened if the indicator signal is buy and can be entered against the signal A sell trade is opened if the indicator signal is sell and can be entered against the signal A goal defined by the number of points Stop loss is limited to the number of pips Profit tracking Stop loss
Hello .I have existing Tradingview strategy that I will like to automate to Mt4 EA based on my specification . I need an expert in the field that have experience in both tradingview and MT4
I Want someone who can Create a Mobile EA Automatic Trading Bot system with My kind of trading style (BTMM) Beat The makert maker,which includes a bit of mixed strategies such as Smart money concept(SMC) and Market Maker Cycle(MMC),The Bot must be Able to Take short and long term trades only after Rejections/confirmations not when it's going against(to minimize/avoid blowing small Accounts),it must place Stoploss and
Hi, Coding Skills Required: Experience in coding trading robots for MT5. Ability to implement increasing coefficients for the distance between orders and lot size 1. Project Objective: Develop an automated trading robot for MetaTrader 5 (MT5) as per the specified trading strategy. 2. Trading Strategy: The robot must execute a strategy that includes the following elements: Opening initial orders. Placing pending
my style of trade is to manually scale position size up & down from 1 to 100+ micros as the market moves, so the indicator I need has nothing to do with scaling in & out of the position, but I need an indicator that dynamically trails the position P&L, And has a trailing daily max loss that will reject new order entry if triggered. Example is setting a $350 Position auto stop-loss so as I scale in & out of contracts

Информация о проекте

Бюджет
30 - 50 USD
Исполнителю
27 - 45 USD
Сроки выполнения
до 4 дн.