Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Creating an indicator like Market Delta

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by antonio View Post
    I currently run my "MarketDelta" indicator twice, once to get the bid/ask on the price chart and again to get the bid/ask stats in an indicator panel (see attached figure). Is there a way to run the indicator once and have data displayed in panels 1 & 2. I tried changing "DrawOnPricePanel" and "Panel" parameters in the code in real-time, but data is only displayed in the price panel. Is there something else I need to do? Thanks.

    [ATTACH]4499[/ATTACH]
    would you share the indicator??

    Comment


      #17
      Bump ,, are you willing to share this indicator??

      Comment


        #18
        any update mate? Im interested in learning about market delta and this would be a good way to start. Cheers

        Comment


          #19
          Not at this time, sorry.

          Comment


            #20
            you want to share what you have so far???

            Comment


              #21
              Care to share the indicator at all yet??

              curious if your able to share the indicator yet

              Comment


                #22
                Originally posted by antonio View Post
                I currently run my "MarketDelta" indicator twice, once to get the bid/ask on the price chart and again to get the bid/ask stats in an indicator panel (see attached figure). Is there a way to run the indicator once and have data displayed in panels 1 & 2. I tried changing "DrawOnPricePanel" and "Panel" parameters in the code in real-time, but data is only displayed in the price panel. Is there something else I need to do? Thanks.

                [ATTACH]4499[/ATTACH]

                Antonio could you explain to us what is the difference of your indicator and market delta please?

                What is the advantage that your indicator could give us?

                Could you post links or something else to understand it please?

                Comment


                  #23
                  Market Delta

                  Originally posted by timmyb View Post
                  curious if your able to share the indicator yet
                  Antonio and lookn4ddeal have made this code available in Tradestation forum. If you are proficient in C+ code you can reprogram this wonderful peace of work .

                  Jaap

                  MARKET DELTA PAINT BARS original by Antonio updated by lookn4ddeal

                  inputs:
                  iVolLo(1000), {VolumeLow, Original ELcodeName was "Threshold1 thru Threshold3}
                  iVolMd(2500),
                  iVolHi(4000),
                  pBidAsk(true), {"p"=Plot,v8.1 Displays Bid-Ask Difference to Left of the PriceBar as "9999 x 9999" }
                  pDelta(true), {Displays Total Delta Amount per PriceBar, Under the Low (DeltaTotal=AllAsks-AllBids)}
                  pAxisTotals(true), {Displays the Column of Delta totals per Horizontal Price, for each Tick Near the Chart rightAxis }
                  Type(1), { 1 = Use Upticks/Downticks, 2 = Use Bid/Ask }
                  _COLOR_INPUTS (0),
                  cAxisLine( DarkGray),
                  cAxisTotalUP(green),
                  cAxisTotalDN(rgb(255,100,200)),
                  cDeltaUP(green),
                  cDeltaDN(rgb(255,0,128)),
                  cBidAskGray(DarkGray),
                  cRed1(RGB(255,200,255)), {Red1=HighestDeltaVolume, Lighter colors more vibrant on Black BackGround}
                  cRed2(RGB(255,175,255)),
                  cRed3(RGB(255,150,255)),
                  cRed4(RGB(255,125,255)),
                  cGrn1(RGB(200,255,200)),
                  cGrn2(RGB(175,255,175)),
                  cGrn3(RGB(150,255,150)),
                  cGrn4(RGB(125,255,125)), {Green4=LowestDeltaVolume, are defaulted as Darker colors}
                  DeltaOffset(.35), {Offset Below PriceBar for Delta(sum of all Deltas on current price Bar}
                  BA_ArraySz(1000), {"BA"=BidAsk, BidAsk Array Size}
                  AlertsOn(true),
                  AlertHigh(4500),
                  AlertLow(-4500);

                  VARS:
                  intrabarpersist Red1(cRed1),intrabarpersist Red2(cRed2),intrabarpersist Red3(cRed3),intrabarpersist Red4(cRed4),
                  intrabarpersist Green1(cGrn1),intrabarpersist Green2(cGrn2),intrabarpersist Green3(cGrn3),intrabarpersist Green4(cGrn4),
                  intrabarpersist TickSize(MinMove / PriceScale),
                  intrabarpersist PriceAtIndex(Open),
                  intrabarpersist BaseIndex(BA_ArraySz/2),
                  intrabarpersist Price(0),
                  intrabarpersist MyVol(0),intrabarpersist VolTmp(0),
                  intrabarpersist LastTick(0),
                  intrabarpersist vCurrentBar(0),
                  intrabarpersist Index(0),
                  intrabarpersist BidAskDelta(0),intrabarpersist xDelta(0),
                  intrabarpersist TextString(""),intrabarpersist TextString2(""),
                  intrabarpersist TextStringBid(""),
                  intrabarpersist vUPTicks(0),intrabarpersist vDNTicks(0),
                  intrabarpersist LowRange(0),intrabarpersist HighRange(0),
                  intrabarpersist FirstTime(true),
                  intrabarpersist LineID(-1),
                  intrabarpersist DaysAgo(0),
                  intrabarpersist i(0);
                  ARRAYS:
                  intrabarpersist Bid[](0),
                  intrabarpersist Ask[](0),
                  intrabarpersist TotalBid[](0),intrabarpersist TotalAsk[](0),
                  intrabarpersist TextIDs[](-1),intrabarpersist TextID2s[](-1);
                  Array_SetMaxIndex(Bid,BA_ArraySz);
                  Array_SetMaxIndex(Ask,BA_ArraySz);
                  Array_SetMaxIndex(TotalBid,BA_ArraySz);
                  Array_SetMaxIndex(TotalAsk,BA_ArraySz);
                  Array_SetMaxIndex(TextIDs,BA_ArraySz);
                  Array_SetMaxIndex(TextID2s,BA_ArraySz);

                  if (Type = 1 or Type = 2) and LastBarOnChart and BarType < 2
                  then begin if FirstTime then begin
                  LowRange = Low;
                  HighRange = High;
                  FirstTime = false;
                  end;
                  MyVol = Ticks;
                  if CurrentBar > vCurrentBar then begin
                  VolTmp = 0;
                  vCurrentBar = CurrentBar;
                  vUPTicks = 0;
                  vDNTicks = 0;
                  for i = 0 to BA_ArraySz - 1 begin
                  Bid<i> = 0;
                  Ask<i> = 0;
                  end;
                  {***** DISPLAY TOTAL BID/ASK BELOW PRICEBAR }
                  if pAxisTotals then begin
                  if LineID <> -1 then
                  TL_Delete(LineID);
                  if Date = Date[1] then
                  DaysAgo = 0
                  else DaysAgo = 1;
                  i = 0;
                  Price = LowD(DaysAgo);
                  while Price <= HighD(DaysAgo)
                  begin if TextIDs<i> <> -1 then begin
                  Text_Delete(TextIDs<i>);
                  Text_Delete(TextID2s<i>);
                  end;
                  TextIDs<i> = -1;
                  TextID2s<i>= -1;
                  Price = Price + TickSize;
                  i = i + 1;
                  end;
                  if Date <> Date[1] then begin
                  LowRange = Low;
                  HighRange = High;
                  for i = 0 to BA_ArraySz - 1
                  begin TotalBid<i> = 0;
                  TotalAsk<i> = 0;
                  end; end; end; end; //end; end; end; end; end; end; end; end; end; end; end; end; end; end;

                  Index = BaseIndex + (Close - PriceAtIndex) / TickSize; { Index= (BA_ArraySz/2) + (Close - Open)/TickSize }
                  if InsideBid < InsideAsk then begin
                  if Type = 1 then begin

                  if DownTicks <> vDNTicks then begin // Use Upticks/Downticks
                  Bid[Index] = Bid[Index] + MyVol - VolTmp;
                  TotalBid[Index] = TotalBid[Index] + MyVol - VolTmp;
                  end else
                  if UpTicks <> vUPTicks then begin
                  Ask[Index] = Ask[Index] + MyVol - VolTmp;
                  TotalAsk[Index] = TotalAsk[Index] + MyVol - VolTmp;
                  end else begin
                  if Close <= LastTick then begin
                  Bid[Index] = Bid[Index] + MyVol - VolTmp;
                  TotalBid[Index] = TotalBid[Index] + MyVol - VolTmp;
                  end else begin
                  Ask[Index] = Ask[Index] + MyVol - VolTmp;
                  TotalAsk[Index] = TotalAsk[Index] + MyVol - VolTmp;
                  end; end;
                  end else begin

                  if Close <= InsideBid then begin // Use Bid/Ask Warning: TradeStation provides snapshot of bid/ask
                  Bid[Index] = Bid[Index] + MyVol - VolTmp;
                  TotalBid[Index] = TotalBid[Index] + MyVol - VolTmp;
                  end else
                  if Close >= InsideAsk then begin
                  Ask[Index] = Ask[Index] + MyVol - VolTmp;
                  TotalAsk[Index] = TotalAsk[Index] + MyVol - VolTmp;
                  end else begin

                  if Close <= LastTick then begin // Last tick was between bid/ask
                  Bid[Index] = Bid[Index] + MyVol - VolTmp;
                  TotalBid[Index] = TotalBid[Index] + MyVol - VolTmp;
                  end else begin
                  Ask[Index] = Ask[Index] + MyVol - VolTmp;
                  TotalAsk[Index] = TotalAsk[Index] + MyVol - VolTmp;
                  end; end; end; end; //end; end; end; end; end; end; end; end; end; end; end; end; end; end;

                  vUPTicks = UpTicks;
                  vDNTicks = DownTicks;
                  VolTmp = MyVol;
                  LastTick = Close;
                  xDelta = 0;
                  Price = Low;
                  while Price <= High
                  begin Index = BaseIndex + (Price - PriceAtIndex) / TickSize;

                  {***** DISPLAY BID/ASK AMOUNT(S)AT THE SIDE OF THE PRICEBARS }
                  if pBidAsk then begin
                  BidAskDelta = Ask[Index] - Bid[Index];
                  //TextString = NumToStr(BidAskDelta,0)+" ";
                  TextString = NumToStr(Bid[Index],0)+" ";
                  TextStringBid = NumToStr(Ask[Index],0)+" ";
                  //TextString = NumToStr(Bid[Index],0) + "-" + NumToStr(Ask[Index],0);
                  Value99 = Text_New(Date,Time,0," ");
                  Value95 = Text_New(Date,Time,0," ");
                  Text_SetString(Value99,TextString);
                  Text_SetString(Value95,TextStringBid);
                  Text_SetLocation(Value99,Date,Time,Price);
                  Text_SetLocation(Value95,Date,Time,Price);
                  Text_SetStyle(Value99,1,2);
                  Text_SetStyle(Value95,1,2);

                  if BidAskDelta > iVolHi
                  then begin Text_SetColor(Value99,cBidAskGray);
                  Text_SetColor(Value95,Green4);
                  end else begin if BidAskDelta > iVolMd
                  then begin Text_SetColor(Value99,cBidAskGray);
                  Text_SetColor(Value95,Green3);
                  end else begin if BidAskDelta > iVolLo
                  then begin Text_SetColor(Value99,cBidAskGray);
                  Text_SetColor(Value95,Green2);
                  end else begin if BidAskDelta >= 0
                  then begin Text_SetColor(Value99,cBidAskGray);
                  Text_SetColor(Value95,Green1);
                  end else begin if BidAskDelta < -iVolHi
                  then begin Text_SetColor(Value95, Red4);
                  Text_SetColor(Value95,cBidAskGray);
                  end else begin if BidAskDelta < -iVolMd
                  then begin Text_SetColor(Value99,Red3);
                  Text_SetColor(Value95,cBidAskGray);
                  end else begin if BidAskDelta < -iVolLo
                  then begin Text_SetColor(Value99,Red2);
                  Text_SetColor(Value95,cBidAskGray);
                  end else begin
                  Text_SetColor(Value99,Red1);
                  Text_SetColor(Value95,cBidAskGray);
                  end; end; end; end; end; end; end; end; //end; end; end; end; end; end; end; end; end; end;

                  xDelta = xDelta + BidAskDelta;
                  Price = Price + TickSize;
                  end;
                  {***** DISPLAY DELTA BID-ASK TOTAL BELOW THE PRICEBARS }
                  if pDelta then begin
                  Value99 = Text_New(Date,Time,0, " ");
                  // Value95 = Text_New(Date,Time,0, " ");
                  Text_SetString(Value99,NumToStr(xDelta,0));
                  // Text_SetString(Value95,NumToStr(xDelta,0));
                  Text_SetLocation(Value99,Date,Time,Low - DeltaOffset);
                  Text_SetStyle(Value99,1,2);
                  if xDelta >= 0
                  then Text_SetColor(Value99,cDeltaUP)
                  else Text_SetColor(Value99,cDeltaDN);
                  end; //end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end;

                  {***** AXIS TOTALS CUMULATIVE DELTA PER PRICE LEVEL DISPLAYED NEAR CHART AXIS LABELS ***********}
                  if pAxisTotals then begin
                  if Low < LowRange then LowRange = Low;
                  if High > HighRange then HighRange = High;

                  LineID = TL_New(Date, Time+BarInterval, LowRange, Date, Time+BarInterval, HighRange);
                  TL_SetColor(LineID, cAxisLine);
                  TL_SetSize(LineID, 2);
                  Price = LowRange;
                  i = 0;

                  while Price <= HighRange
                  begin Index = BaseIndex + (Price - PriceAtIndex) / TickSize;
                  TextString = NumToStr(TotalAsk[Index],0) + " ";
                  if TotalAsk[Index] > 999 and TotalAsk[Index] < 10000 then {most common occurance positioned 1st in ELcode}
                  TextString2= " " + NumToStr(TotalBid[Index],0) {v9.23 Added 2 Spaces from " " to " "}
                  else if TotalAsk[Index] > 9999 then {v9.23 Aligns Numbers to Right}
                  TextString2= " " + NumToStr(TotalBid[Index],0)
                  else if TotalAsk[Index] < 1000 then
                  TextString2= " " + NumToStr(TotalBid[Index],0); {v9.23 Added4 Spaces (2 per character)}

                  Value90 = Text_New(Date, Time+BarInterval, 0, TextString);
                  Value91 = Text_New(Date, Time+BarInterval, 0, TextString2);
                  TextIDs<i> = Value90;
                  Text_SetLocation(Value90, Date, Time+BarInterval, Price);
                  Text_SetStyle(Value90, 1, 2);
                  TextID2s<i> = Value91;
                  Text_SetLocation(Value91, Date, Time+BarInterval, Price);
                  Text_SetStyle(Value91, 0, 2);
                  if TotalBid[Index] - TotalAsk[Index] > 0
                  then begin Text_SetColor(Value91, cAxisTotalDN);
                  Text_SetColor(Value90, cBidAskGray);
                  Price = Price + TickSize;
                  i = i + 1;
                  end else begin
                  Text_SetColor(Value90, cAxisTotalUP);
                  Text_SetColor(Value91, cBidAskGray);

                  // if TotalBid[Index] - TotalAsk[Index] > 0 // v8.25
                  // then Text_SetColor(Value90, cAxisTotalDN) // v8.25
                  // else Text_SetColor(Value90, cAxisTotalUP); // v8.25
                  Price = Price + TickSize;
                  i = i + 1;
                  end; end; end; end; //end; end; end; end; end; end; end; end; end; end; end; end; end; end;

                  {***** Alert criteria }
                  If AlertsOn then begin
                  if xDelta > AlertHigh then {original: if OneAlert( xDelta > AlertHigh ) then }
                  Alert( "Delta High Volume" )
                  else
                  if xDelta < AlertLow then
                  Alert( "Delta Low Volume" ) ;
                  end; //end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end;

                  Comment


                    #24
                    market delta

                    has anyone been able to convert this code for NT7?

                    Comment


                      #25
                      Depending on how strongly you want it converted, you could also check out a NinjaScript consultant to assist you -



                      For a similar technique you can check into a NinjaTrader add on FinAlg offers - http://www.fin-alg.com/product.html
                      Last edited by NinjaTrader_Bertrand; 02-18-2010, 01:13 PM.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #26
                        Is there a way to automatically turn off price bars in an indicator (i.e., make price bars transparent)?

                        Comment


                          #27
                          antonio, this could be for example done by setting the Bar and Outline colors to transparent -


                          BertrandNinjaTrader Customer Service

                          Comment


                            #28
                            hi guys, i want to create a delta volume profile but not on each tick but for point. exaple for dax i want to see delta only at 12000,12001,12002 ecc ecc.
                            can you help me??
                            thanks

                            Comment


                              #29
                              Hello Jack86,

                              Thank you for the post.

                              Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

                              You can contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services.

                              Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
                              Chris L.NinjaTrader Customer Service

                              Comment


                                #30
                                Is there still interest in this indicator?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by sidlercom80, 10-28-2023, 08:49 AM
                                166 responses
                                2,234 views
                                0 likes
                                Last Post sidlercom80  
                                Started by thread, Yesterday, 11:58 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post thread
                                by thread
                                 
                                Started by jclose, Yesterday, 09:37 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post jclose
                                by jclose
                                 
                                Started by WeyldFalcon, 08-07-2020, 06:13 AM
                                10 responses
                                1,414 views
                                0 likes
                                Last Post Traderontheroad  
                                Started by firefoxforum12, Yesterday, 08:53 PM
                                0 responses
                                11 views
                                0 likes
                                Last Post firefoxforum12  
                                Working...
                                X