Skip to content

trade-assistant #3392

@zaghianm1357

Description

@zaghianm1357

import { useState } from "react";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";

export default function TradeAssistant() {
const [symbol, setSymbol] = useState("EURUSD");
const [mainTF, setMainTF] = useState("60");
const [entryTF, setEntryTF] = useState("15");

const getChartURL = (tf: string) => {
return https://s.tradingview.com/widgetembed/?frameElementId=tradingview_${tf}&symbol=FX:${symbol}&interval=${tf}&hidesidetoolbar=1&hidetoptoolbar=1&symboledit=1&saveimage=0&toolbarbg=f1f3f6&studies=[]&theme=dark&style=1&timezone=Etc%2FUTC&withdateranges=1&hideideas=1&watchlist=[];
};

return (




Symbol
<Input value={symbol} onChange={(e) => setSymbol(e.target.value.toUpperCase())} />


Main Timeframe
<Input value={mainTF} onChange={(e) => setMainTF(e.target.value)} />


Entry Timeframe
<Input value={entryTF} onChange={(e) => setEntryTF(e.target.value)} />

  <Tabs defaultValue="main" className="w-full">
    <TabsList>
      <TabsTrigger value="main">Main TF ({mainTF})</TabsTrigger>
      <TabsTrigger value="entry">Entry TF ({entryTF})</TabsTrigger>
    </TabsList>
    <TabsContent value="main">
      <iframe
        key={mainTF + symbol}
        src={getChartURL(mainTF)}
        width="100%"
        height="600"
        frameBorder="0"
        allowTransparency={true}
        scrolling="no"
      ></iframe>
    </TabsContent>
    <TabsContent value="entry">
      <iframe
        key={entryTF + symbol}
        src={getChartURL(entryTF)}
        width="100%"
        height="600"
        frameBorder="0"
        allowTransparency={true}
        scrolling="no"
      ></iframe>
    </TabsContent>
  </Tabs>
</div>

);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions