Requesting a code conversion

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #125830 quote
    jebus89
    Participant
    Master

    Hello, i got this from a fellow algotrader, he said he is using Thinkorswim

     

    input price = close;
    input MainLength = 1000;
    input Sensitivity = 30;
    input Sensitivity2 = 15;
    input BuyAmount = 20;
    input SellAmount = 1;
    input SellHeavyAmount = 35;
    input AvgDownAmount = 20;
    
    
    def linDev = LinDev(price, 1000);
    def CCI = if linDev == 0 then 0 else (price - Average(price, 1000)) / linDev / 0.015;
    def CCIDrop = CCI > CCI[1];
    
    def EMA1 = MovingAverage(AverageType.EXPONENTIAL, price, 90);
    def HMA1 = MovingAverage(AverageType.HULL, price, MainLength);
    def HMA2 = MovingAverage(AverageType.HULL, price, 180);
    def HMA3 = MovingAverage(AverageType.HULL, price, 40);
    
    def MainBullishZone = HMA1 > HMA1[Sensitivity];
    def MainBearishZone = HMA1 < HMA1[Sensitivity2] and CCIDrop;
    def SubBullishZone = HMA2 > HMA2[200];
    def SubBearishZone = HMA2 < HMA2[35];
    def IntraBullishZone = HMA3 > HMA3[10];
    def IntraBearishZone = HMA3 < HMA3[10];
    
    def BUYSignal = MainBullishZone and SubBearishZone and IntraBullishZone and (HMA1 < HMA2) and (HMA1 < HMA3) and (HMA3 < HMA2) and price < HMA3 and price < EMA1 and CCI < 100;
    
    def AvgDownSignal = MainBullishZone and SubBearishZone and IntraBullishZone and price < HMA1 and price < HMA2 and CCI < 100 and HMA2 < HMA2[155];
    
    def BuyExitSignal = price crosses below HMA2 and MainBullishZone and SubBullishZone and IntraBearishZone and price > HMA1 and CCI < 100;
    
    def SELLSignal = MainBearishZone and SubBullishZone and IntraBearishZone and (HMA1 > HMA2) and (HMA1 > HMA3) and (HMA3 > HMA2) and price < HMA3 and price > EMA1;
    
    def EmergencySELL = SubBearishZone and CCI < -30;
    
    def EmergencyCOVER = CCI > 5 and CCI < 100 and CCI > CCI[200];
    
    def Short = price crosses below HMA2 and MainBullishZone and SubBullishZone and IntraBearishZone and price > HMA1 and CCI > 140;
    
    
    input crossingType = {default above, below};
    
    def avg1 = MovingAverage(AverageType.EXPONENTIAL, close, 60);
    def avg2 = MovingAverage(AverageType.EXPONENTIAL, close, 180);
    
    def signal = Crosses(avg1, avg2, crossingType == crossingType.above);
    def signal2 = avg1 crosses above avg2;
    
    AddOrder(condition = BUYSignal, name = "BUY", price = close, tradeSize = BuyAmount);
    AddOrder(condition = AvgDownSignal, name = "AvgDown", tradeSize = AvgDownAmount);
    AddOrder(OrderType.SELL_AUTO, BuyExitSignal and !MainBullishZone[30], name = "Sell", tradeSize = SellAmount);
    AddOrder(OrderType.SELL_AUTO, Short, name = "Sell Heavy", tradeSize = SellHeavyAmount);
    AddOrder(condition = MainBearishZone, name = "Close", type = OrderType.SELL_TO_CLOSE);
    AddOrder(OrderType.BUY_TO_CLOSE, SELLSignal, name = "COVER");
    #125835 quote
    Vonasi
    Moderator
    Master

    jebus89 – You should know better!

    Nicolas requires lots more info as explained here:

    https://www.prorealcode.com/free-code-conversion/

    A description of how it works plus screen shots are always helpful plus maybe a link to where you found it. Also your title is meaningless which is against forum rules – if you can  describe the indicator or give it a name we can edit the topic title so that it actually means something.

    #125881 quote
    Nicolas
    Keymaster
    Master

    Yes! Please jebus 😐

    Add the additional information below and I’ll modify your topic.

    #126050 quote
    jebus89
    Participant
    Master

    Well shoot, my bad guys. I thought i was in the right place..

     

    I dont have any information except this piece of code.

    I dont have any screenshots.

    Just forget the whole thing 🙂 Sorry for wasting your time.

    #126065 quote
    Nicolas
    Keymaster
    Master

    Not a big problem to convert this code, but is it worth it? Just asking…

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Requesting a code conversion


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
jebus89 @jebus89 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Nicolas
5 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/12/2020
Status: Active
Attachments: No files
Logo Logo
Loading...